[vue] 手写一个自定义指令及写出如何调用
Activity
a799791706 commentedon Aug 9, 2019
vue.directive('custom-module', {
insetred: function(el,binding,vnode){
}
});
veWangCorn commentedon Sep 19, 2019
const style={
bind(el,binding,vnode){
el.style.color = 'pink'
}
}
Vue.directive('style',style)
pink
DanielLeefu commentedon Dec 25, 2019
全局自定义指令
Vue,directive('test',(el,binding,vnode)=>{
业务逻辑
})
局部指令
directives:{
test(el,binding,vnode){
业务逻辑
}
}
调用,都是v-test