|
@@ -560,6 +560,23 @@ export default {
|
|
|
this.showArticleFlag = true;
|
|
this.showArticleFlag = true;
|
|
|
this.styleData = this.data.word_time[index].wordsResultList;
|
|
this.styleData = this.data.word_time[index].wordsResultList;
|
|
|
},
|
|
},
|
|
|
|
|
+ handleGlobalEsc(event) {
|
|
|
|
|
+ if (event.key === 'Escape' || event.key === 'Esc' || event.keyCode === 27) {
|
|
|
|
|
+ this.isSelecting = false;
|
|
|
|
|
+ this.startX = 0;
|
|
|
|
|
+ this.startY = 0;
|
|
|
|
|
+ this.endX = 0;
|
|
|
|
|
+ this.endY = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ // 添加全局事件监听器
|
|
|
|
|
+ document.addEventListener('keyup', this.handleGlobalEsc);
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeDestroy() {
|
|
|
|
|
+ // 移除全局事件监听器
|
|
|
|
|
+ document.removeEventListener('keyup', this.handleGlobalEsc);
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|