Skip to content

Commit

Permalink
fix(tree-select): 自定义标签关闭异常
Browse files Browse the repository at this point in the history
修复关闭自定义标签报错,并无法关闭

#2601
  • Loading branch information
sinbadmaster committed Jul 27, 2023
1 parent dbcd0d7 commit 3035a83
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/tree-select/tree-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import FakeArrow from '../common-components/fake-arrow';
import { TreeSelectValue, TdTreeSelectProps } from './type';
import { useTNodeJSX, useTNodeDefault } from '../hooks/tnode';
import useTreeSelect from './useTreeSelect';
import { TreeOptionData } from '..';

export default defineComponent({
name: 'TTreeSelect',
Expand Down Expand Up @@ -187,9 +188,14 @@ export default defineComponent({
valueDisplay: () => this.renderTNodeJSX('valueDisplay', {
params: this.multiple
? {
value: this.nodeInfo,
onClose: (value: TagInputValue, context: TagInputChangeContext) => {
this.tagChange(value, context);
value: this.nodeInfo as TreeOptionData<string | number>[],
onClose: (index: number) => {
const value = this.nodeInfo.map((node: TreeOptionData) => node.value);
this.tagChange(value, {
trigger: 'tag-remove',
index,
item: value[index],
});
},
}
: {
Expand Down

0 comments on commit 3035a83

Please sign in to comment.