Skip to content

Commit 8e466ec

Browse files
committed
Fix issue when starting opened and fixed tooltips set to true (#30)
1 parent 75d7f50 commit 8e466ec

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/FAB.vue

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<transition
1212
enter-active-class="animated quick zoomIn"
1313
leave-active-class="animated quick zoomOut"
14+
v-on:after-enter="afterActionsTransitionEnter"
1415
>
1516
<template v-if="action.tooltip">
1617
<li v-if="toggle" :style="{ 'background-color': action.color || bgColor }"
@@ -116,6 +117,9 @@
116117
fixedTooltip: {
117118
default: false
118119
},
120+
tooltipTimeOutWhenStartOpened: {
121+
default: 200
122+
},
119123
enableRotation:{
120124
default: true
121125
},
@@ -276,19 +280,19 @@
276280
wrapper.insertBefore(el, wrapper.childNodes[0]);
277281
}
278282
},
279-
showTooltip(show) {
280-
if (show && this.actions.length && this.fixedTooltip) {
281-
282-
//timeout to prevent wrong position for the tooltip
283-
setTimeout(() => {
284-
this.$refs.actions.forEach((item) => {
285-
if(this.toggle) {
286-
item._tooltip.show();
287-
}
288-
});
289-
},700);
290-
283+
showTooltip(timeOut = 0) {
284+
if (this.toggle && this.actions.length && this.fixedTooltip) {
285+
setTimeout(() => {
286+
this.$refs.actions.forEach((item) => {
287+
if(this.toggle) {
288+
item._tooltip.show();
289+
}
290+
});
291+
},timeOut);
291292
}
293+
},
294+
afterActionsTransitionEnter() {
295+
this.showTooltip();
292296
}
293297
},
294298
watch: {
@@ -299,16 +303,17 @@
299303
this.moveTransition();
300304
this.tooltipPos();
301305
});
302-
},
303-
toggle(val) {
304-
this.showTooltip(val);
305306
}
306307
},
307308
mounted() {
308309
this.moveTransition();
309310
},
310311
created() {
311312
this.setPosition();
313+
314+
if (this.startOpened) {
315+
this.showTooltip(this.tooltipTimeOutWhenStartOpened);
316+
}
312317
}
313318
}
314319
</script>

0 commit comments

Comments
 (0)