From 3db9b7f56e0ebbe1bac1c374f54a6f555f69a55a Mon Sep 17 00:00:00 2001 From: Poised_flw Date: Mon, 1 Nov 2021 15:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96dialog=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Dialog/Pc.vue | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/tis_app_template_kt/src/components/Dialog/Pc.vue b/src/tis_app_template_kt/src/components/Dialog/Pc.vue index 85e5c71..d61f6d2 100644 --- a/src/tis_app_template_kt/src/components/Dialog/Pc.vue +++ b/src/tis_app_template_kt/src/components/Dialog/Pc.vue @@ -53,10 +53,10 @@ import VueDragResize from 'vue-drag-resize' return window.outerHeight; }, isDraggable() { - return true; + return this.isMax ? false : true; }, isResizable() { - return true; + return this.isMax ? false : true; }, isTitle() { return true; @@ -71,6 +71,7 @@ import VueDragResize from 'vue-drag-resize' data() { return { + // 是否最大化 isMax:false, isDestory:false, showSizeChoice: false, @@ -80,6 +81,7 @@ import VueDragResize from 'vue-drag-resize' height: Math.round(window.innerHeight * .6), top: Math.round(window.innerHeight * .2), left: Math.round(window.innerWidth * .2), + _style: {}, // 缓存最大化之前的数据 }; }, methods: { @@ -93,11 +95,29 @@ import VueDragResize from 'vue-drag-resize' this.curHeight = newRect.height; }, onMaxSize(){ - this.$refs.dragEl.$el.style.left = 0 - this.$refs.dragEl.$el.style.top = 0 - const $contentEl = this.$refs.dragEl.$el.firstChild - $contentEl.style.width = window.innerWidth + 'px' - $contentEl.style.height = window.innerHeight + 'px' + this.isMax = !this.isMax + + const $dragEl = this.$refs.dragEl.$el + const $contentEl = $dragEl.firstChild + // 最大化 + if (this.isMax) { + this._style = { + width: this.width, + height: this.height, + left: this.left, + top: this.top + } + $dragEl.style.left = 0 + $dragEl.style.top = 0 + $contentEl.style.width = window.innerWidth + 'px' + $contentEl.style.height = window.innerHeight + 'px' + } + else { + $dragEl.style.left = this._style.left + $dragEl.style.top = this._style.top + $contentEl.style.width = this._style.width + 'px' + $contentEl.style.height = this._style.height + 'px' + } return; this.isMax = !this.isMax; this.left = 0