Fixed #3558 - Unique values created in components are set incorrectly.

This commit is contained in:
mertsincan 2023-01-19 04:01:03 +00:00
parent 86a34cde87
commit 2da56f7ed9
18 changed files with 120 additions and 52 deletions

View file

@ -89,6 +89,7 @@ export default {
list: null,
data() {
return {
id: this.$attrs.id,
focused: false,
focusedItemInfo: { index: -1, level: 0, parentKey: '' },
activeItemPath: [],
@ -97,6 +98,9 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
},
activeItemPath(newPath) {
if (ObjectUtils.isNotEmpty(newPath)) {
this.bindOutsideClickListener();
@ -122,6 +126,8 @@ export default {
this.container = null;
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.global) {
this.bindDocumentContextMenuListener();
}
@ -611,9 +617,6 @@ export default {
return processedItem ? processedItem.items : this.processedItems;
},
id() {
return this.$attrs.id || UniqueComponentId();
},
focusedItemId() {
return this.focusedItemInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : ''}_${this.focusedItemInfo.index}` : null;
}