fix: new directive syntax

see: https://v3.vuejs.org/guide/migration/custom-directives.html
This commit is contained in:
Dominik Pschenitschni 2021-08-22 14:10:12 +02:00
parent 78a5096e0d
commit 3c89147ee2
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
export default { export default {
// When the bound element is inserted into the DOM... // When the bound element is inserted into the DOM...
inserted: (el, {modifiers}) => { mounted: (el, {modifiers}) => {
// Focus the element only if the viewport is big enough // Focus the element only if the viewport is big enough
// auto focusing elements on mobile can be annoying since in these cases the // auto focusing elements on mobile can be annoying since in these cases the
// keyboard always pops up and takes half of the available space on the screen. // keyboard always pops up and takes half of the available space on the screen.

View file

@ -22,7 +22,7 @@ const calculateArrowTop = (top, tooltip) => {
const createdTooltips = {} const createdTooltips = {}
export default { export default {
inserted: (el, {value, modifiers}) => { mounted(el, {value, modifiers}) {
// First, we create the tooltip and arrow elements // First, we create the tooltip and arrow elements
const tooltip = document.createElement('div') const tooltip = document.createElement('div')
tooltip.style.position = 'fixed' tooltip.style.position = 'fixed'
@ -74,7 +74,7 @@ export default {
arrow: arrow, arrow: arrow,
} }
}, },
unbind: el => { unmounted(el) {
if (typeof createdTooltips[el] !== 'undefined') { if (typeof createdTooltips[el] !== 'undefined') {
createdTooltips[el].tooltip.remove() createdTooltips[el].tooltip.remove()
createdTooltips[el].arrow.remove() createdTooltips[el].arrow.remove()