多处使用window监听键盘,只有一处生效:
mounted() {
window.onkeydown = (e) => {
this.handleKeyDown(e)
}
}
使用的地方改为:
mounted() {
window.addEventListener("keydown", (e) => {
this.handleKeyDown(e)
})
}
多处使用window监听键盘,只有一处生效:
mounted() {
window.onkeydown = (e) => {
this.handleKeyDown(e)
}
}
使用的地方改为:
mounted() {
window.addEventListener("keydown", (e) => {
this.handleKeyDown(e)
})
}