在一个vue的main.js中注册全局的自定义指令失效
new Vue({
el: '#app',
router,//使用router组件;
template: '',
components: { App },
directives: {
globalf: function(el, binding){
el.style.color = binding.value
},
globals: function(el, binding){
el.style.color = binding.value
}
}
}) |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
//注册Vue.directive('my-directive',{bind:function(){},inserted:function(){},update:function(){},componentUpdated:function(){},unbind:function(){}})//注册(指令函数)Vue.directive('my-directive',function(){//这里将会被`bind`和`update`调用})//getter,返回已注册的指令varmyDirective=Vue.directive('my-directive') |
|
|
|
|