功能说明:
对评分做出判断,有没有评分值,若没有评分显示:未评分;若有显示评分值。
- 页面.wxml:
条件渲染wx:if,wx:else
当有评分值时,显示we:if,隐藏else值;反之,无值时,执行else语句。
- 页面.js:
productAll: [
//美食
[{
"id": 0,
"commentValue": 5 / 2,
},
{
"id": 1,
"commentValue": 10 / 2,
}
],
],
- 效果图: