klren0312 / daliy_knowledge

知识积累,正确使用方式是watch
21 stars 4 forks source link

ant design select 互斥选择 #688

Open klren0312 opened 1 year ago

klren0312 commented 1 year ago
  const getValueFromEvent = (args: string[]) => {
    if (args && args.length) {
      const lastVal = args[args.length - 1];
      // 如果选择的是*则返回*
      if (lastVal === '*') {
        return ['*'];
      } else {
        return args.filter(v => v !== '*');
      }
    }
    return args;
  };
<Form.Item
   getValueFromEvent={e => getValueFromEvent(e)}
></Form.Item>