From 6e72dab53f951c8080495a792dc36c8f7382ad17 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期五, 16 四月 2021 16:57:38 +0800 Subject: [PATCH] 弹出窗口只弹一个 --- src/components/layer/src/layer.vue | 30 ++++++++++++++++++++++-------- src/components/layer/src/layer.js | 21 ++++----------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/components/layer/src/layer.js b/src/components/layer/src/layer.js index 2d2db28..e177272 100644 --- a/src/components/layer/src/layer.js +++ b/src/components/layer/src/layer.js @@ -25,6 +25,7 @@ content: opt.content, area: opt.area } */ + self.closeAll() var options = mergeJson(opt, defOptions) const id = `notification_${new Date().getTime()}_${seed++}` options.id = id @@ -55,7 +56,6 @@ * @return {[type]} [description] */ self.close = function (id) { - console.log(id) const oElm = document.getElementById(id).parentElement if (oElm) { document.body.removeChild(oElm) @@ -111,22 +111,9 @@ * @param {[type]} id [description] * @return {[type]} [description] */ - self.closeAll = function (type = -1) { - const types = { - page: 0, - iframe: 1 - } - if (type === -1) { - for (const k in self.instances) { - self.close(k) - } - } else { - const targetType = types[type] - for (const k in self.instances) { - if (self.instances[k].type === targetType) { - self.close(k) - } - } + self.closeAll = function () { + for (const k in self.instances) { + self.close(k) } } /** diff --git a/src/components/layer/src/layer.vue b/src/components/layer/src/layer.vue index b29753a..6d406d1 100644 --- a/src/components/layer/src/layer.vue +++ b/src/components/layer/src/layer.vue @@ -1,7 +1,8 @@ <template> - <div class="public-bounced map-background" v-drag> + <div class="public-bounced map-background" v-drag :style="style"> <div class="public-bounced-title panel-title" ref="publicBounced"> <span>{{title}}</span> + <i class="el-icon-circle-close" @click="max"></i> <i class="el-icon-circle-close" @click="close"></i> </div> <div class="public-bounced-content" :id="id"> @@ -18,6 +19,7 @@ cls: { 'vl-notify-iframe': true }, + style: {}, id: 'vlip' + new Date().getTime() } }, @@ -30,13 +32,6 @@ } }, computed: { - contentStyle () { - return { - height: 'calc(100% - 50px)', // parseInt(this.options.area[1]) - 50 + "px", - minHeight: '20px', - overflow: 'auto' - } - } }, async mounted () { helper.hiddenScrollBar(this.options) @@ -57,6 +52,25 @@ }) instance.vm = instance.$mount() document.getElementById(this.id).appendChild(instance.vm.$el) + }, + max () { + // 鏈�澶у寲绐楀彛 + let height = document.documentElement.clientHeight + if (height % 2 === 1) { + height += 1 + } + this.style = { + overflow: 'hidden', + left: '50%', + width: '100%', + height: height + 'px', + minHeight: '42px' + } + this.maxMiniState = 2 + }, + maxmini () { // 杩樺師 + document.getElementById(this.options.id).removeAttribute('style') + this.maxMiniState = 0 } } } -- Gitblit v1.8.0