From 188d0ed258f5c584cba8c288c020548b1c7e9286 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Thu, 11 Aug 2022 09:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=AB=E9=83=BD=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/dv/apps/components/PdGrid.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/project/dv/apps/components/PdGrid.vue b/project/dv/apps/components/PdGrid.vue index 75a3f744..4ab1783a 100644 --- a/project/dv/apps/components/PdGrid.vue +++ b/project/dv/apps/components/PdGrid.vue @@ -61,6 +61,26 @@ isShowGrid1: false, currIndex1: 0 } + }, + + mounted () { + this.$nextTick(() => { + this.$nextTick(() => { + document.addEventListener('keydown', this.onKeyDown) + }) + }) + }, + + destroyed () { + document.removeEventListener('keydown', this.onKeyDown) + }, + + methods: { + onKeyDown (e) { + if (e.keyCode == 27) { + this.isShowGrid1 = false + } + } } }