Vue.directive('auth', {bind:function (el, binding, vnode) { //el是对应的dom,binding中包含你传过来的参数 if(binding.value)el.parentNode.removeChild(el); }} );