Skip to content

Commit

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

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

* fix: 删除无用代码
  • Loading branch information
sinbadmaster authored and uyarn committed Aug 3, 2023
1 parent 9f83e13 commit 0e7adc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 0 files
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, { TreeProps } from '../tree';
import props from './props';
import SelectInput, { SelectInputProps } 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 @@ -189,9 +189,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 0e7adc5

Please sign in to comment.