Refactor #4953 - For TreeSelect

pull/5206/head
mertsincan 2024-02-02 15:48:06 +00:00
parent 784f7d943e
commit 0575260911
1 changed files with 6 additions and 1 deletions

View File

@ -120,12 +120,16 @@ export default {
emits: ['update:modelValue', 'before-show', 'before-hide', 'change', 'show', 'hide', 'node-select', 'node-unselect', 'node-expand', 'node-collapse', 'focus', 'blur'], emits: ['update:modelValue', 'before-show', 'before-hide', 'change', 'show', 'hide', 'node-select', 'node-unselect', 'node-expand', 'node-collapse', 'focus', 'blur'],
data() { data() {
return { return {
id: this.$attrs.id,
focused: false, focused: false,
overlayVisible: false, overlayVisible: false,
expandedKeys: {} expandedKeys: {}
}; };
}, },
watch: { watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
},
modelValue: { modelValue: {
handler: function () { handler: function () {
if (!this.selfChange) { if (!this.selfChange) {
@ -161,6 +165,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.id || UniqueComponentId();
this.updateTreeState(); this.updateTreeState();
}, },
methods: { methods: {
@ -487,7 +492,7 @@ export default {
return !this.options || this.options.length === 0; return !this.options || this.options.length === 0;
}, },
listId() { listId() {
return UniqueComponentId() + '_list'; return this.id + '_list';
} }
}, },
components: { components: {