Commit ed18fff 1 parent 5a0c3d1 commit ed18fff Copy full SHA for ed18fff
File tree 1 file changed +10
-6
lines changed
packages/lib/src/components/core/lume-tooltip
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
- v-show =" opened && targetElement"
3
+ v-if =" opened && targetElement"
4
4
ref =" root"
5
5
class =" lume-tooltip lume-typography--caption"
6
6
:class =" {
@@ -66,6 +66,7 @@ interface TooltipItem {
66
66
<script setup lang="ts">
67
67
import {
68
68
computed ,
69
+ nextTick ,
69
70
onBeforeUnmount ,
70
71
onMounted ,
71
72
PropType ,
@@ -214,14 +215,15 @@ function destroyPopper() {
214
215
if (popper .value ) {
215
216
popper .value .destroy ();
216
217
emit (' closed' );
217
- root .value .classList .remove (' lume-tooltip--animated' ); // Remove transition class
218
+
219
+ root .value && root .value .classList .remove (' lume-tooltip--animated' ); // Remove transition class
218
220
}
219
221
}
220
222
221
223
function updatePopper() {
222
224
if (! popper .value ) return ;
223
225
224
- if (allOptions .value .withAnimation !== false ) {
226
+ if (allOptions .value .withAnimation !== false && root . value ) {
225
227
root .value .classList .add (' lume-tooltip--animated' ); // Add transition class
226
228
}
227
229
@@ -237,9 +239,11 @@ function updatePopper() {
237
239
// Watchers
238
240
watch (
239
241
() => props .targetElement ,
240
- (newValue , oldValue ) => {
241
- if (! oldValue && newValue ) initPopper ();
242
- else updatePopper ();
242
+ async (newValue , oldValue ) => {
243
+ if (! oldValue && newValue ) {
244
+ await nextTick (); // wait for `root` to be picked up
245
+ initPopper ();
246
+ } else updatePopper ();
243
247
}
244
248
);
245
249
You can’t perform that action at this time.
0 commit comments