wong1988 1 year ago
parent
commit
8de4e58cb4
  1. 2
      pages/home/cloudCard2.vue
  2. 51
      uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

2
pages/home/cloudCard2.vue

@ -171,7 +171,7 @@
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="base" title="订购协议" :showConfirm="true" <uni-popup-dialog ref="inputClose" mode="more" title="订购协议" :showConfirm="true"
:beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm" :beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm"
:content="data.brandVos[selectIndex2].dgxy" :confirm-text="confirmText"></uni-popup-dialog> :content="data.brandVos[selectIndex2].dgxy" :confirm-text="confirmText"></uni-popup-dialog>
</uni-popup> </uni-popup>

51
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

@ -4,12 +4,17 @@
<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text> <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text>
</view> </view>
<view v-if="mode === 'base'" class="uni-dialog-content"> <view v-if="mode === 'base'" class="uni-dialog-content">
<slot>
<text class="uni-dialog-content-text">{{content}}</text>
</slot>
</view>
<view v-if="mode === 'more'" class="uni-dialog-content">
<slot> <slot>
<textarea class="uni-dialog-content-text" :value="content" :auto-height="false" <textarea class="uni-dialog-content-text" :value="content" :auto-height="false"
:maxlength="10000"></textarea> :style="{'height':contentHeight}" :maxlength="10000"></textarea>
</slot> </slot>
</view> </view>
<view v-else class="uni-dialog-content"> <view v-if="mode === 'input'" class="uni-dialog-content">
<slot> <slot>
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" <input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText"
:focus="focus"> :focus="focus">
@ -117,7 +122,8 @@
return { return {
dialogType: 'warn', dialogType: 'warn',
focus: false, focus: false,
val: "" val: "",
contentHeight: '135px'
} }
}, },
computed: { computed: {
@ -146,6 +152,9 @@
}, },
value(val) { value(val) {
this.val = val this.val = val
},
content() {
this.getHeight()
} }
}, },
created() { created() {
@ -185,6 +194,42 @@
}, },
close() { close() {
this.popup.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);
} }
} }
} }

Loading…
Cancel
Save