A custom directive similar to v-if in vuejs
Try to use this hack: Vue.directive(‘permission’, (el, binding, vnode) => { if (!isUserGranted(binding.value)) { // replace HTMLElement with comment node const comment = document.createComment(‘ ‘); Object.defineProperty(comment, ‘setAttribute’, { value: () => undefined, }); vnode.elm = comment; vnode.text=” “; vnode.isComment = true; vnode.context = undefined; vnode.tag = undefined; vnode.data.directives = undefined; if (vnode.componentInstance) { vnode.componentInstance.$el = … Read more