From 0bfa3d941437e326d57c11d3e6345234b559dd35 Mon Sep 17 00:00:00 2001 From: Pascal Barth Date: Fri, 30 Aug 2024 07:59:13 +0200 Subject: [PATCH 1/3] PB-788 : stop using reserved "id" property for menu section identifier It wasn't handled properly when a child component was declaring the ID itself, the parent MenuTray couldn't access the value of ID. --- .../menu/components/menu/MenuSection.vue | 8 +++--- src/modules/menu/components/menu/MenuTray.vue | 26 +++++++++---------- .../components/print/MenuPrintSection.vue | 10 ++++--- .../components/share/MenuShareSection.vue | 6 ++--- .../components/topics/MenuTopicSection.vue | 14 +++++----- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/modules/menu/components/menu/MenuSection.vue b/src/modules/menu/components/menu/MenuSection.vue index fbe6ad8bc..7237cd0d6 100644 --- a/src/modules/menu/components/menu/MenuSection.vue +++ b/src/modules/menu/components/menu/MenuSection.vue @@ -52,7 +52,7 @@ export default { }, props: { // String that uniquely identifies this section - id: { + sectionId: { type: String, required: true, }, @@ -78,7 +78,7 @@ export default { default: false, }, }, - expose: ['close', 'open', 'id'], + expose: ['close', 'open', 'sectionId'], emits: ['openMenuSection', 'closeMenuSection', 'click:header'], data() { return { @@ -111,9 +111,9 @@ export default { if (this.showBody !== value) { this.showBody = value if (this.showBody) { - this.$emit('openMenuSection', this.id) + this.$emit('openMenuSection', this.sectionId) } else { - this.$emit('closeMenuSection', this.id) + this.$emit('closeMenuSection', this.sectionId) } } }, diff --git a/src/modules/menu/components/menu/MenuTray.vue b/src/modules/menu/components/menu/MenuTray.vue index a1a74788a..585a4c305 100644 --- a/src/modules/menu/components/menu/MenuTray.vue +++ b/src/modules/menu/components/menu/MenuTray.vue @@ -82,9 +82,9 @@ function onCloseMenuSection(id) { * * @param {any} el Reference to the element */ -function addRefById(el) { - if (el !== null && !Object.keys(refs.value).includes(el.id)) { - refs.value[el.id] = el +function addRefBySectionId(el) { + if (el !== null && !Object.keys(refs.value).includes(el.sectionId)) { + refs.value[el.sectionId] = el } } @@ -104,21 +104,21 @@ function addRefById(el) {