From 8de4e58cb484cab8c8167f485f9f8ad20b4cc7d5 Mon Sep 17 00:00:00 2001 From: wong1988 Date: Sun, 21 Jan 2024 16:39:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/cloudCard2.vue | 2 +- .../uni-popup-dialog/uni-popup-dialog.vue | 51 +++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/pages/home/cloudCard2.vue b/pages/home/cloudCard2.vue index 98dfba6..37710c5 100644 --- a/pages/home/cloudCard2.vue +++ b/pages/home/cloudCard2.vue @@ -171,7 +171,7 @@ - diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue index e8c9fcc..47352f5 100644 --- a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue +++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue @@ -4,12 +4,17 @@ {{titleText}} + + {{content}} + + + + :style="{'height':contentHeight}" :maxlength="10000"> - + @@ -117,7 +122,8 @@ return { dialogType: 'warn', focus: false, - val: "" + val: "", + contentHeight: '135px' } }, computed: { @@ -146,6 +152,9 @@ }, value(val) { this.val = val + }, + content() { + this.getHeight() } }, created() { @@ -185,6 +194,42 @@ }, close() { this.popup.close() + }, + getHeight() { + + + let height = '135px' + + try { + + if (this.mode != 'more') { + return + } + + const count = (this.content.match(/\n/g) || []).length; + // 粗略高度 + let temp = this.content.replaceAll("\n", ""); + + let col = temp.length / 18 + 1 + let totalHeight = (col + count) * 15 + // 568 + let height2 = getApp().globalData.navInfo.window.height + + let maxHeight = (height2 - 170) / 3 + + if (totalHeight > maxHeight) { + height = maxHeight + 'px' + } else { + height = totalHeight + 'px' + } + + } catch (e) { + //TODO handle the exception + } + + this.contentHeight = height + + console.log("======", this.contentHeight); } } }