Vue доступ к директивам on и class из директивы - PullRequest
0 голосов
/ 29 октября 2018

Я хочу сгруппировать несколько директив в пользовательскую директиву, как показано ниже, с model:

const model = Vue.directive('model')

Vue.directive('custom', {
    bind(el, binding, vnode, oldVnode) {
        // do custom directive stuff
        // modify binding for model

        if (model.bind)
            model.bind(el, binding, vnode, oldVnode)
    },
    inserted(el, binding, vnode, oldVnode) {
        if (model.inserted)
            model.inserted(el, binding, vnode, oldVnode)
    },
    update(el, binding, vnode, oldVnode) {
        if (model.update)
            model.update(el, binding, vnode, oldVnode)
    },
    componentUpdated(el, binding, vnode, oldVnode) {
        if (model.componentUpdated)
            model.componentUpdated(el, binding, vnode, oldVnode)
    },
    unbind(el, binding, vnode, oldVnode) {
        if (model.unbind)
            model.unbind(el, binding, vnode, oldVnode)
    }
})

Но, к сожалению, только model и show доступны через Vue.directive, а не on или class. Насколько я могу судить, другие директивы как-то исправлены и недоступны для меня.

Я нахожусь в среде webpack и хотел бы знать, есть ли способ получить доступ к другим директивам. Даже если он взломан.

Спасибо

...