Skip to content

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

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

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

Activity

a799791706

a799791706 commented on Aug 9, 2019

@a799791706

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

}
});

veWangCorn

veWangCorn commented on Sep 19, 2019

@veWangCorn

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

pink

DanielLeefu

DanielLeefu commented on Dec 25, 2019

@DanielLeefu

全局自定义指令
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@a799791706@veWangCorn@DanielLeefu

        Issue actions

          [vue] 手写一个自定义指令及写出如何调用 · Issue #316 · haizlin/fe-interview