vueボタンにenterキーをバインドする
2744 ワード
ログインボタンにenterキーをバインドする
あまり話さないで、直接コードをつけましょう~
この文章は別のup主のコードを参考にしていますが、昨日書いたのでそのブロガーが見つからない@です(●´◡`●)
あまり話さないで、直接コードをつけましょう~
<el-button type="primary" @click="submitForm('loginForm')"> </el-button>
created () {
let that = this
document.onkeydown = function (e) {
e = window.event || e
// enter
if (that.$route.path === '/login' && (e.code === 'Enter' || e.code === 'enter')) {
//
that.submitForm('loginForm')
}
}
},
この文章は別のup主のコードを参考にしていますが、昨日書いたのでそのブロガーが見つからない@です(●´◡`●)