vue 实现登录键盘enter事件
1.话不多说,先来个小漩涡2.上代码<el-button type=“primary” v-on:keyup.13.native=“submit”@click=“submitForm(‘ruleForm2’)” size=“medium”>登 录3.created(){var _this = this;document.onkeydown = function...
·
1.话不多说,先来个小漩涡
2.上代码
<el-button type="primary" v-on:keyup.13.native="submit" @click="submitForm('ruleForm2')" size="medium">登 录</el-button>
created(){
var _this = this;
document.onkeydown = function(e) {
let key = window.event.keyCode;
if (key == 13) {
_this.submit();
}
};
}
methods(){
submit(){
this.submitForm()
},
}
更多推荐
已为社区贡献7条内容
所有评论(0)