From c4638b589d80e9853ec6a530d8d30afd28367e9a Mon Sep 17 00:00:00 2001 From: gaby64 Date: Thu, 5 Dec 2019 17:35:36 -0500 Subject: [PATCH] observe tooltip content for changes update position on tooltip change --- src/components/MdTooltip/MdTooltip.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/MdTooltip/MdTooltip.vue b/src/components/MdTooltip/MdTooltip.vue index ad9e4692b..7624928ff 100644 --- a/src/components/MdTooltip/MdTooltip.vue +++ b/src/components/MdTooltip/MdTooltip.vue @@ -32,7 +32,9 @@ }, data: () => ({ shouldRender: false, - targetEl: null + targetEl: null, + observer: {}, + mutated: null }), computed: { tooltipClasses () { @@ -43,6 +45,7 @@ }, popperSettings () { return { + mutated: this.mutated, placement: this.mdDirection, modifiers: { offset: { @@ -62,9 +65,14 @@ }, methods: { show () { - this.shouldRender = true + this.shouldRender = true; + this.$nextTick().then(() => { + this.observer = new MutationObserver(mutations => this.mutated = mutations); + this.observer.observe(this._vnode.componentInstance.$el, { attributes: false, childList: true, characterData: true, subtree: true }); + }); }, hide () { + this.observer.disconnect(); this.shouldRender = false } },