小程序页面wxml中if else
wxml if else 使用如下:
<text class=”title2″ wx:if=”{{store.service_all_day==1}}”>24小时营业{{store.in_business == ‘1’ ? ‘营业中’ : ‘休息中’}}</text>
<textclass=”title2″wx:elseif=”{{store.service_all_day==2}}>营业时间{{store.service_starttime}}到{{store.sevevice_end_time}} {{store.in_business == ‘1’ ? ‘营业中’ : ‘休息中’}}</text>
下面是我在使用中遇到的坑:三目运算中store.service_starttime和store.sevevice_end_time里面有冒号,导致变量解析不了,所以才换成了上面的写法:
{{store.in_business == ‘1’ ? ‘营业中store.service_starttime’ : ‘休息中store.sevevice_end_time’}}