自定义指令 Vue.directive('focus',{ //事件实施时间 bind inserted update inserted:function(el){ //js方法 el.focus(); } }) 自定义指令使用方法 v-指令名 v-focus