vue-tippy
Advanced tools
Comparing version 0.2.6 to 0.2.7
{ | ||
"name": "vue-tippy", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "vue-tippy.js", |
@@ -34,2 +34,7 @@ # vue-tippy | ||
#### Bind settings | ||
```html | ||
<button title="Hello" v-tippy="{ position : 'top', arrow: true }"> My Button! </button> | ||
``` | ||
#### Popper HTML | ||
@@ -36,0 +41,0 @@ ```html |
102
vue-tippy.js
@@ -31,3 +31,3 @@ const Tippy = require('tippy.js'); | ||
if (index > -1) | ||
Vue.$tippyInstances.splice(index, 1); | ||
Vue.$tippyInstances.splice(index, 1); | ||
@@ -50,11 +50,13 @@ }, | ||
instance.tippy.store.forEach(function (s) { | ||
if (instance.tippy && instance.tippy && instance.tippy.store) { | ||
instance.tippy.store.forEach(function (s) { | ||
if (s.settings.html) { | ||
Vue.nextTick(function () { | ||
s.tippyInstance.update(s.popper); | ||
}); | ||
} | ||
if (s && s && s.settings && s.settings.html) { | ||
Vue.nextTick(function () { | ||
s.tippyInstance.update(s.popper); | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -68,13 +70,60 @@ }); | ||
inserted: function (el, binding, vnode, oldVnode) { | ||
const handlers = (vnode.data && vnode.data.on) || | ||
(vnode.componentOptions && vnode.componentOptions.listeners); | ||
el.tippy = new Tippy(el, { | ||
onShow: function () { | ||
var opts = binding.value || {}; | ||
opts.onShow = function () { | ||
if (handlers && handlers["show"]) { | ||
handlers["show"].fns(); | ||
} | ||
}; | ||
opts.onShown = function () { | ||
if (handlers && handlers["shown"]) { | ||
handlers["shown"].fns(); | ||
} | ||
}; | ||
opts.onHidden = function () { | ||
if (handlers && handlers["hidden"]) { | ||
handlers["hidden"].fns(); | ||
} | ||
}; | ||
opts.onHide = function () { | ||
if (handlers && handlers["hide"]) { | ||
handlers["hide"].fns(); | ||
} | ||
}; | ||
el.tippy = new Tippy(el, opts); | ||
Vue.$tippyInstances.push({ | ||
el: el, | ||
tippy: el.tippy, | ||
}) | ||
}, | ||
unbind: function (el, binding, vnode) { | ||
vnode.context.$tippy.destroyTippy(el); | ||
}, | ||
componentUpdated: function (el, binding,vnode) { | ||
var opts = binding.value || {}; | ||
var oldValue = binding.oldValue || {}; | ||
if (el.tippy && ( JSON.stringify(opts) !== JSON.stringify(oldValue) )) { | ||
const handlers = (vnode.data && vnode.data.on) || (vnode.componentOptions && vnode.componentOptions.listeners); | ||
vnode.context.$tippy.destroyTippy(el); | ||
opts.onShow = function () { | ||
if (handlers && handlers["show"]) { | ||
handlers["show"].fns(); | ||
} | ||
}, | ||
onShown: function () { | ||
}; | ||
opts.onShown = function () { | ||
@@ -84,28 +133,23 @@ if (handlers && handlers["shown"]) { | ||
} | ||
}, | ||
onHidden: function () { | ||
}; | ||
opts.onHidden = function () { | ||
if (handlers && handlers["hidden"]) { | ||
handlers["hidden"].fns(); | ||
} | ||
}, | ||
onHide: function () { | ||
}; | ||
opts.onHide = function () { | ||
if (handlers && handlers["hide"]) { | ||
handlers["hide"].fns(); | ||
} | ||
}, | ||
}); | ||
Vue.$tippyInstances.push({ | ||
el: el, | ||
tippy: el.tippy, | ||
}; | ||
}) | ||
el.tippy = new Tippy(el, opts); | ||
Vue.$tippyInstances.push({ | ||
el: el, | ||
tippy: el.tippy, | ||
}, | ||
unbind: function (el, binding, vnode) { | ||
vnode.context.$tippy.destroyTippy(el); | ||
}, | ||
componentUpdated: function (el) { | ||
}) | ||
} | ||
else if (el.tippy && (el.getAttribute('title') || el.getAttribute('data-html'))) { | ||
if (el.tippy && (el.getAttribute('title') || el.getAttribute('data-html'))) { | ||
el.tippy.store.forEach(function (s) { | ||
@@ -112,0 +156,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
246246
3984
67