【需求】:進入某個界面,輸入框自動獲取焦點?!締栴}】:使用iView框架中的輸入框,如何給這個輸入框添加一個自定義指令?【代碼】:iView中的輸入框組件:
<template>
<Input v-model="value14" v-focus placeholder="Enter something..." clearable style="width: 200px"></Input>
</template>
自定義指令:
Vue.directive('focus', {
inserted: function (el) {
console.log('el-->',el); // el.focus();
}
});【問題描述】:現在這個el操作的是input的父級元素,我要如何才能操作當前這個元素的子元素?
如何給IView中的輸入框增加一個自定義指令?
慕田峪4524236
2018-07-08 17:24:18