feat: issue#10507 优化代码

This commit is contained in:
常鹏元 2024-07-08 20:54:06 +08:00
parent 51dd3cf8fa
commit fb54e5c676

View File

@ -174,16 +174,14 @@ export default class TagControl extends React.PureComponent<
/** 处理输入的内容 */
normalizeInputValue(inputValue: string): Option[] {
const {enableBatchAdd, separator, valueField, labelField, delimiter, max} =
const {enableBatchAdd, separator, valueField, labelField, delimiter} =
this.props;
let batchValues = [];
if (enableBatchAdd && separator && typeof separator === 'string') {
batchValues = inputValue.split(separator);
} else {
const inputValueArr = uniq(
compact(inputValue.split(delimiter || ','))
).slice(0, max);
const inputValueArr = uniq(compact(inputValue.split(delimiter || ',')));
batchValues.push(...inputValueArr);
}