Skip to content

Commit

Permalink
feat(tree-select): add context param when pick value (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Dec 21, 2022
1 parent d1ddc1a commit 41b3e61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/tree-select/_example/base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
style="width: 300px"
:data="options"
v-model="value"
:popupVisible="popupVisible"
@blur="onBlurTrigger"
@popup-visible-change="onVisibleChange"
filterable
clearable
placeholder="请选择"
Expand All @@ -14,6 +16,7 @@ export default {
data() {
return {
value: '',
popupVisible: false,
options: [
{
label: '广东省',
Expand Down Expand Up @@ -51,6 +54,11 @@ export default {
onBlurTrigger(context) {
console.log(context);
},
onVisibleChange(v, c) {
if (c.trigger || c.node?.label !== '广州市') {
this.popupVisible = v;
}
},
},
};
</script>
2 changes: 1 addition & 1 deletion src/tree-select/tree-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default defineComponent({
// 多选模式屏蔽 Active 事件
if (props.multiple) return;

setInnerVisible(false, {});
setInnerVisible(false, context);

// 单选模式重复选择不清空
if (treeSelectValue.value === context.node.data[realValue.value]) {
Expand Down

0 comments on commit 41b3e61

Please sign in to comment.