Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vue] 手写一个自定义指令及写出如何调用 #316

Open
haizhilin2013 opened this issue Jun 20, 2019 · 3 comments
Open

[vue] 手写一个自定义指令及写出如何调用 #316

haizhilin2013 opened this issue Jun 20, 2019 · 3 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

[vue] 手写一个自定义指令及写出如何调用

@haizhilin2013 haizhilin2013 added the vue vue label Jun 20, 2019
@a799791706
Copy link

vue.directive('custom-module', {
insetred: function(el,binding,vnode){

}
});

@veWangCorn
Copy link

const style={
bind(el,binding,vnode){
el.style.color = 'pink'
}
}
Vue.directive('style',style)

pink

@DanielLeefu
Copy link

全局自定义指令
Vue,directive('test',(el,binding,vnode)=>{
业务逻辑
})

局部指令
directives:{
test(el,binding,vnode){
业务逻辑
}
}
调用,都是v-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vue vue
Projects
None yet
Development

No branches or pull requests

4 participants