From 3cf3efc59b213e5c52f4b1527e4ea032f8e17f00 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 12 Jul 2021 18:33:46 +0800 Subject: [PATCH] no message --- .../assets/js/components/DrawerOverlay.vue | 19 +++++++++++++++++++ .../pages/manage/components/FileContent.vue | 1 + resources/assets/js/pages/manage/file.vue | 5 ++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/DrawerOverlay.vue b/resources/assets/js/components/DrawerOverlay.vue index 0dcce1ad6..c2f6ce1aa 100644 --- a/resources/assets/js/components/DrawerOverlay.vue +++ b/resources/assets/js/components/DrawerOverlay.vue @@ -27,6 +27,10 @@ type: Boolean, default: true }, + escClosable: { + type: Boolean, + default: true + }, placement: { validator (value) { return ['right', 'bottom'].includes(value) @@ -45,6 +49,14 @@ } }, + mounted () { + document.addEventListener('keydown', this.escClose); + }, + + beforeDestroy () { + document.removeEventListener('keydown', this.escClose); + }, + computed: { bodyStyle() { let size = parseInt(this.size); @@ -72,6 +84,13 @@ close() { this.$emit("input", !this.value) }, + escClose(e) { + if (this.value && this.escClosable) { + if (e.keyCode === 27) { + this.close() + } + } + } } } diff --git a/resources/assets/js/pages/manage/components/FileContent.vue b/resources/assets/js/pages/manage/components/FileContent.vue index 95b8b9d69..94ea7261e 100644 --- a/resources/assets/js/pages/manage/components/FileContent.vue +++ b/resources/assets/js/pages/manage/components/FileContent.vue @@ -112,6 +112,7 @@ export default { handler(info) { if (this.fileId != info.id) { this.fileId = info.id; + this.contentDetail = null; this.getContent(); } }, diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index a2c1fa575..8f4e28a6b 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -195,7 +195,10 @@ - +