vue组件写键盘事件,
<el-input v-model="query" placeholder="搜索" @keyup.z.stop="log"/>
事件写法 function log(e) {
console.log(e);
if (e.ctrlKey && e.key == 'z') {
console.log('-----------------------------', e.KeyboardEvent);
query.value = '';
}
}
打印一下事件就知道,点击哪个键,对应的key会有对应的值。对事件监听即可