效果图:
1、template
bash
<view @click="showPriceDialog"></view>
2、data
bash
data() {
return {
contentText:"",
}
},
3、methods
bash
// 价格公示
showPriceDialog: function() {
// 吨
let minPriceTon = 1900
let maxPriceTon = 3895
// 袋
let minPriceBag = 890
let maxPriceBag = 1785
// 车
let minPriceCar = 56
let maxPriceCar = 499
this.contentText = "每吨 "+minPriceTon+"至"+maxPriceTon+"元\n每袋"+minPriceBag+"至"+maxPriceBag+"元\n每车"+minPriceCar+"至"+maxPriceCar+"元"
//换行
let contentInfo = this.contentText.replace(/<br>/g,"\n")
uni.showModal({
title: "价格公示",
content: contentInfo,
confirmText: "确定",
showCancel: false,
success: (res) => {
}
})
},