Skip to content

Commit

Permalink
fix(#4953): use beforeMount to generate unique component id (#4954)
Browse files Browse the repository at this point in the history
  • Loading branch information
i7slegend authored Jan 16, 2024
1 parent 23360e7 commit e8b5b8f
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 28 deletions.
2 changes: 1 addition & 1 deletion components/lib/accordion/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
this.d_activeIndex = newValue;
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
methods: {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/autocomplete/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ export default {
this.autoUpdateModel();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.autoUpdateModel();
},
updated() {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/cascadeselect/CascadeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ export default {
this.autoUpdateModel();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.autoUpdateModel();
},
beforeUnmount() {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/contextmenu/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ export default {
}
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
if (this.global) {
this.bindDocumentContextMenuListener();
}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/dock/DockSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
this.id = newValue || UniqueComponentId();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
methods: {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ export default {
this.autoUpdateModel();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.autoUpdateModel();
this.bindLabelClickListener();
},
Expand Down
5 changes: 3 additions & 2 deletions components/lib/listbox/Listbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ export default {
this.autoUpdateModel();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.autoUpdateModel();
},
methods: {
Expand Down
4 changes: 3 additions & 1 deletion components/lib/megamenu/MegaMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ export default {
}
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.bindMatchMediaListener();
},
beforeUnmount() {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ export default {
resizeListener: null,
container: null,
list: null,
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
if (!this.popup) {
this.bindResizeListener();
this.bindOutsideClickListener();
Expand Down
4 changes: 3 additions & 1 deletion components/lib/menubar/Menubar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ export default {
outsideClickListener: null,
container: null,
menubar: null,
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.bindMatchMediaListener();
},
beforeUnmount() {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/multiselect/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,10 @@ export default {
this.autoUpdateModel();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.autoUpdateModel();
},
beforeUnmount() {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/orderlist/OrderList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ export default {
this.reorderDirection = null;
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
if (this.responsive) {
this.createStyle();
}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/panelmenu/PanelMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
this.id = newValue || UniqueComponentId();
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
methods: {
Expand Down
5 changes: 3 additions & 2 deletions components/lib/picklist/PickList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ export default {
this.destroyStyle();
this.destroyMedia();
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
if (this.responsive) {
this.createStyle();
this.initMedia();
Expand Down
5 changes: 3 additions & 2 deletions components/lib/speeddial/SpeedDial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ export default {
this.d_visible = newValue;
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
if (this.type !== 'linear') {
const button = DomHandler.findSingle(this.container, '[data-pc-name="button"]');
const firstItem = DomHandler.findSingle(this.list, '[data-pc-section="menuitem"]');
Expand Down
5 changes: 3 additions & 2 deletions components/lib/tabview/TabView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ export default {
this.scrollInView({ index: newValue });
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
mounted() {
this.updateInkBar();
this.scrollable && this.updateButtonState();
},
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tieredmenu/TieredMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default {
}
}
},
mounted() {
beforeMount() {
this.id = this.id || UniqueComponentId();
},
beforeUnmount() {
Expand Down

0 comments on commit e8b5b8f

Please sign in to comment.