HTML方法三元判断
第一种
<!-- 绑定支管 {{ props.item.branchValveName }}-->
<!--如果内容为空,显示无,如果传递过来的内容不为空,展示内容-->
<td class="text-xs-left">{{ props.item.branchValveName=="" ? "无" : props.item.branchValveName }}</td>
<!-- 绑定主水泵{{ props.item.mainPumpName }} -->
<td class="text-xs-left">{{ props.item.mainPumpName==""?"无":props.item.mainPumpName}}</td>
第二种
正数显示+,负值显示-
<text class="green account_left_top">{{item.num > 0 ? `+${item.num}` : `-${item.num}`}}</text>
第三种
正数显示+,负值显示-
<text class="green account_left_top" v-if="item.num>0">+{{item.num}}</text>
<text class="green account_left_top" v-else>-{{item.num}}</text>
JS方法三元判断
data() {
return {
//Array(uni.getStorageSync('wx_code_pic')) 为数组
imgList: Array(uni.getStorageSync('wx_code_pic')).length > 0 ? Array(uni.getStorageSync('wx_code_pic')) :[],
}
}