created() { this.keyDown(); }, beforeDestroy() { this.keyDownReview(); }, methods: { //按键恢复 keyDownReview() { document.onkeydown = function (event) { var e = event || window.event; e.returnValue = true; }; }, //键盘按钮截获 keyDown() { document.onkeydown = (e) => {
// 46--delete,8--回退 if (e.keyCode === 8 || e.keyCode === 46) { //delete键后执行刷新方法 this.deletePlotBtnClickHandler(); //取消原来的后续事件 e.preventDefault(); } }; },
}
标签:vue,46,event,键盘,按键,document,keyDownReview,监听 From: https://www.cnblogs.com/Hhuizi/p/17452174.html