vue

自定义指令:

全局指令
Vue.directive('focus',{

inserted(el) {
    el.focus()
}

})

调用 v-focus

组件,实例上的指令
directives: {

demo(el,) {
        xxx
}
demo:{
    bind(el,binding){
        
    }
}

}

过滤器filter

{{gender | g}}

Vue.filter('g',(value)=>{

return  xxx

})
也可以在局部上定义过滤器
filters:{

g(value){
}

}
还可以定义多个,并绑定多个过滤器
绑定多个过滤器时,后一个过滤器是上一个过滤后的value

还可以加参数

插件
使用插件:

Vue.use('插件',参数)
开发咯

插件.install = function(Vue,options){

Vue.xxx = function(){}

全局资源
Vue.directives(){}

Vue.mixins(){}

在实例上绑定方法
Vue.prototype.$xxx(){}

}

Vue-CLI:起步

vue create xiaomi
1,4,5,6
stuless
in packgjson
no
yarn

Last modification:July 24th, 2019 at 11:13 pm
如果觉得我的文章对你有用,请随意赞赏