Browse Source

优化dialog最大化逻辑

master
Poised_flw 4 years ago
parent
commit
3db9b7f56e
  1. 34
      src/tis_app_template_kt/src/components/Dialog/Pc.vue

34
src/tis_app_template_kt/src/components/Dialog/Pc.vue

@ -53,10 +53,10 @@ import VueDragResize from 'vue-drag-resize'
return window.outerHeight; return window.outerHeight;
}, },
isDraggable() { isDraggable() {
return true;
return this.isMax ? false : true;
}, },
isResizable() { isResizable() {
return true;
return this.isMax ? false : true;
}, },
isTitle() { isTitle() {
return true; return true;
@ -71,6 +71,7 @@ import VueDragResize from 'vue-drag-resize'
data() { data() {
return { return {
//
isMax:false, isMax:false,
isDestory:false, isDestory:false,
showSizeChoice: false, showSizeChoice: false,
@ -80,6 +81,7 @@ import VueDragResize from 'vue-drag-resize'
height: Math.round(window.innerHeight * .6), height: Math.round(window.innerHeight * .6),
top: Math.round(window.innerHeight * .2), top: Math.round(window.innerHeight * .2),
left: Math.round(window.innerWidth * .2), left: Math.round(window.innerWidth * .2),
_style: {}, //
}; };
}, },
methods: { methods: {
@ -93,11 +95,29 @@ import VueDragResize from 'vue-drag-resize'
this.curHeight = newRect.height; this.curHeight = newRect.height;
}, },
onMaxSize(){ 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; return;
this.isMax = !this.isMax; this.isMax = !this.isMax;
this.left = 0 this.left = 0

Loading…
Cancel
Save