vue使用element-ui 监听使用回车键事件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/adley_app/article/details/84376119
  • 因为element-ui 对input做了封装,使用@keyup.enter="fn"触发Enter键事件就不会触发,解决:后面追加.native。@keyup.enter.native="submitForm" 即可解决。
<el-form-item prop="password">
   <el-input type="password" v-model="password" @keyup.enter.native="submitForm" placeholder="请输入密码" >
        <el-button slot="prepend" icon="el-icon-lx-lock"></el-button>
    </el-input>
</el-form-item>

猜你喜欢

转载自blog.csdn.net/adley_app/article/details/84376119
今日推荐