<div id="app">
<input type="text" v-focus>
<input type="text" v-focus>
</div>
</body>
<script type="text/javascript">
/**
* 自定义指令
*/
Vue.directive('focus',{
inserted:function (el) {
//el表示指令所绑定的元素
el.focus();
}
})
vue自定义指令
最新推荐文章于 2023-07-03 17:05:53 发布