Skip to content

Commit

Permalink
fix(tree-select): 自定义标签关闭异常 (Tencent#2631)
Browse files Browse the repository at this point in the history
* fix(tree-select): 自定义标签关闭异常

修复关闭自定义标签报错,并无法关闭

Tencent#2601

* fix: 删除无用代码

Tencent#2601
  • Loading branch information
sinbadmaster authored and methodchen committed Aug 25, 2023
1 parent f900313 commit c7376c4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/tree-select/tree-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import isFunction from 'lodash/isFunction';
import Tree from '../tree';
import props from './props';
import SelectInput from '../select-input';
import { TagInputChangeContext, TagInputValue } from '../tag-input';
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 +187,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 c7376c4

Please sign in to comment.