当前位置: 首页 > Web前端 > vue.js

vue---自定义指令

时间:2023-03-31 14:43:39 vue.js

自定义指令//自定义指令Vue.directive('focus',{bind(el,binding){console.log(el,binding,'----------')},inserted(el){el.focus()console.log(el,'++++++++')}})Vue.component('ComponentA',{template:'

'})varvm=newVue({el:"#app",data:{msg:'sxq'},template:'
<组件A>
'})