hekigan / vue-directive-tooltip

Vue.js tooltip directive. Easy to use, configure and style
https://hekigan.github.io/vue-directive-tooltip/
MIT License
173 stars 33 forks source link

Extend Directive #32

Closed daverogers closed 6 years ago

daverogers commented 6 years ago
import Tooltip from 'vue-directive-tooltip'

Vue.use(Tooltip, {
    delay: 200,
    placement: 'top',
    class: 'our-tooltip',
    triggers: ['hover'],
    offset: 0
});

So this works great, but I'd like to extend the package to always use those defaults in every instance - our company has a lot of separate apps so we don't use the same instance of Vue. I've extended filters and components before, but I'm not finding anything on extending directives. Is it possible? Or do we just need to have Vue.use() on every app?

hekigan commented 6 years ago

Hi, I know it's been a while since you asked and I am back from the dead. To answer you, the directive is nothing else than a javascript Object. So I don't see why you could not extend it. You could totally use the config property to implements your defaults. I never did it, but it should be doable.