mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
feat: issue#10507 优化代码
This commit is contained in:
parent
51dd3cf8fa
commit
fb54e5c676
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user