app/components/lookbook/button/component.js in lookbook-1.5.5 vs app/components/lookbook/button/component.js in lookbook-2.0.0.beta.0

- old
+ new

@@ -11,13 +11,13 @@ tooltip = initTooltip(this, { target: this.$refs.icon, }); } - if (this.$refs.dropdown) { + if (this.dropdownContent) { dropdown = tippy(this.$el, { - content: this.$refs.dropdown.innerHTML, + content: this.dropdownContent, trigger: "click", theme: "menu", triggerTarget: this.$el, interactive: true, zIndex: 99999, @@ -30,20 +30,30 @@ onHide: () => this.$dispatch("dropdown:hide", { dropdown: this }), }); } }, + get dropdownContent() { + if (this.$root && this.$root.id) { + const dropdown = document.querySelector( + `[data-dropdown-id="${this.$root.id}"]` + ); + return dropdown ? dropdown.innerHTML : null; + } + return null; + }, + hideDropdown() { if (dropdown) { dropdown.hide(); } }, updateDropdown() { if (dropdown) { dropdown.hide(); this.$nextTick(() => { - dropdown.setContent(this.$refs.dropdown.innerHTML); + dropdown.setContent(this.dropdownContent); }); } }, startSpin() {