为了账号安全,请及时绑定邮箱和手机立即绑定

VUE2.0 的 mint-ui 的文本输入框filed 怎么绑定focus blur事件

VUE2.0 的 mint-ui 的文本输入框filed 怎么绑定focus blur事件

Smart猫小萌 2019-02-26 21:38:29
<v-field  label="用户名:" placeholder="输入用户名" v-model="userName"  @focus="show"></v-field>用的Mint-uishow不会执行
查看完整描述

1 回答

?
回首忆惘然

TA贡献1847条经验 获得超11个赞

最后自己找到解决方法了:


mt-field 组件中有input元素, 找到input 并且赋予 focus和blur事件;


//定义自定义指令来使用


//使用  v-lfocus 指令

<mt-field type="text" placeholder="输入账号" v-model="phone" v-lfcous></mt-field>


//自定义指令

 Vue.directive('lfcous', function(el, pra, a) {


    let oInput = el.querySelector('input');

    oInput.onfocus = function() {

           //创建focus的事件

    };


    oInput.onblur = function() {

          //同时创建blur事件

    };

})


查看完整回答
反对 回复 2019-03-08
  • 1 回答
  • 0 关注
  • 3132 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号