From 181cb37e496854289a78ccef50ee4bd8bec9c4eb Mon Sep 17 00:00:00 2001 From: eloiqs Date: Thu, 17 Nov 2016 11:40:33 -0500 Subject: [PATCH 1/2] wrap popover element in div with v-if --- src/Popover.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Popover.vue b/src/Popover.vue index 8bc17050..3982cb2c 100644 --- a/src/Popover.vue +++ b/src/Popover.vue @@ -2,16 +2,18 @@ -
-
-

- {{title}} -

-
- {{{content}}} +
+
+
+

+ {{title}} +

+
+ {{{content}}} +
From 38cf2827896ba3723e701f6e41dc7b262bd94720 Mon Sep 17 00:00:00 2001 From: eloiqs Date: Thu, 17 Nov 2016 11:41:18 -0500 Subject: [PATCH 2/2] use vue nextTick instead of setTimeout --- src/utils/popoverMixins.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/popoverMixins.js b/src/utils/popoverMixins.js index 746998f5..b8a0d912 100644 --- a/src/utils/popoverMixins.js +++ b/src/utils/popoverMixins.js @@ -1,3 +1,4 @@ +import {nextTick} from 'vue' import {coerce} from './utils.js' import $ from './NodeList.js' @@ -39,7 +40,7 @@ export default { toggle (e) { if (e && this.trigger === 'contextmenu') e.preventDefault() if (!(this.show = !this.show)) { return } - setTimeout(() => { + nextTick(() => { const popover = this.$els.popover const trigger = this.$els.trigger.children[0] switch (this.placement) { @@ -64,7 +65,7 @@ export default { } popover.style.top = this.position.top + 'px' popover.style.left = this.position.left + 'px' - }, 0) + }) } }, ready () {