|
13 | 13 | leave-active-class="animated quick zoomOut" |
14 | 14 | > |
15 | 15 | <template v-if="action.tooltip"> |
16 | | - <li v-if="toggle" :style="{ 'background-color': action.color || bgColor }" |
17 | | - v-tooltip="{ content: action.tooltip, placement: tooltipPosition, classes: 'fab-tooltip' }" |
18 | | - @click="toParent(action.name)" class="pointer"> |
| 16 | + <li v-show="toggle" :style="{ 'background-color': action.color || bgColor }" |
| 17 | + v-tooltip="{ content: action.tooltip, placement: tooltipPosition, classes: 'fab-tooltip', trigger: tooltipTrigger}" |
| 18 | + @click="toParent(action.name)" class="pointer" |
| 19 | + ref="actions"> |
19 | 20 | <i :class="[ actionIconSize ,'material-icons']">{{action.icon}}</i> |
20 | 21 | </li> |
21 | 22 | </template> |
|
72 | 73 | <script> |
73 | 74 | import {mixin as clickaway} from 'vue-clickaway'; |
74 | 75 | import Ripple from 'vue-ripple-directive'; |
75 | | - import { VTooltip } from 'v-tooltip' |
| 76 | + import {VTooltip} from 'v-tooltip' |
76 | 77 |
|
77 | 78 | export default { |
78 | 79 | mixins: [clickaway], |
|
112 | 113 | mainTooltip: { |
113 | 114 | default: null |
114 | 115 | }, |
| 116 | + fixedTooltip: { |
| 117 | + default: false |
| 118 | + }, |
115 | 119 | actions: {} |
116 | 120 | }, |
117 | 121 | computed: { |
|
197 | 201 | leave: 'animated fadeOutDown' |
198 | 202 | }; |
199 | 203 | } |
| 204 | + }, |
| 205 | + tooltipTrigger() { |
| 206 | +
|
| 207 | + if (this.fixedTooltip) { |
| 208 | + return 'manual'; |
| 209 | + } |
| 210 | +
|
| 211 | + return 'hover'; |
200 | 212 | } |
201 | 213 | }, |
202 | 214 | methods: { |
203 | 215 | tooltipPos() { |
204 | | - if(this.position === 'top-right' || this.position === 'bottom-right') { |
| 216 | + if (this.position === 'top-right' || this.position === 'bottom-right') { |
205 | 217 | this.tooltipPosition = 'left' |
206 | | - } else { |
| 218 | + } else { |
207 | 219 | this.tooltipPosition = 'right' |
208 | 220 | } |
209 | 221 | }, |
|
247 | 259 | } else { |
248 | 260 | wrapper.insertBefore(el, wrapper.childNodes[0]); |
249 | 261 | } |
| 262 | + }, |
| 263 | + showTooltip(show) { |
| 264 | + if (show && this.$refs.actions && this.fixedTooltip) { |
| 265 | +
|
| 266 | + //timeout to prevent wrong position for the tooltip |
| 267 | + setTimeout(() => { |
| 268 | + this.$refs.actions.forEach((item) => { |
| 269 | + item._tooltip.show(); |
| 270 | + }); |
| 271 | + },600); |
| 272 | +
|
| 273 | + }else{ |
| 274 | + this.$refs.actions.forEach((item) => { |
| 275 | + item._tooltip.hide(); |
| 276 | + }); |
| 277 | + } |
250 | 278 | } |
251 | 279 | }, |
252 | 280 | watch: { |
|
257 | 285 | this.moveTransition(); |
258 | 286 | this.tooltipPos(); |
259 | 287 | }); |
| 288 | + }, |
| 289 | + toggle(val) { |
| 290 | + this.showTooltip(val); |
260 | 291 | } |
261 | 292 | }, |
262 | 293 | mounted() { |
|
282 | 313 | padding: 5px 10px 4px; |
283 | 314 | } |
284 | 315 |
|
285 | | - .fab-tooltip.tooltip tooltip-arrow{ |
| 316 | + .fab-tooltip.tooltip tooltip-arrow { |
286 | 317 | display: none; |
287 | 318 | } |
288 | 319 |
|
|
0 commit comments