评论商品接口有问题
This commit is contained in:
@@ -161,6 +161,22 @@
|
||||
getData()
|
||||
}
|
||||
|
||||
const formatNumberWithWan = num => {
|
||||
if (num < 10000) {
|
||||
return num.toString()
|
||||
}
|
||||
|
||||
// 保留小数:根据需求可调整 toFixed 的位数
|
||||
let wan = num / 10000
|
||||
|
||||
// 如果是整数万,不显示小数;否则保留两位小数(或你想要的位数)
|
||||
if (wan % 1 === 0) {
|
||||
return wan + '万'
|
||||
} else {
|
||||
return wan.toFixed(2).replace(/\.?0+$/, '') + '万' // 去掉不必要的尾随零
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
const now = new Date()
|
||||
currentYear.value = now.getFullYear()
|
||||
@@ -184,7 +200,7 @@
|
||||
<view class="public-header—box">
|
||||
<view class="integral-box">
|
||||
<text>我的积分</text>
|
||||
<text>{{ userInfo.totalPoints }}</text>
|
||||
<text>{{ formatNumberWithWan(userInfo.totalPoints) }}</text>
|
||||
</view>
|
||||
<image
|
||||
src="/static/images/discover/calendar.png"
|
||||
|
||||
Reference in New Issue
Block a user