class的写法
<view class="nav-item {{currentTab == idx ?'active':''}}"></view>
style的写法
<view style="height:{{item.open ? myheight + 'px' : ''}}; transition: height .1s linear;">
用于div或者text等标签上的写法
<text>{{currentTab == '1' ? '就餐次数' : '就餐人数'}}</text>
在js的写法
item.active = (sub==index)?true:false;
原理就是判断条件true还是false,如果是true就返回前面的,如果是false就返回后面的
同样,vue的项目写法也是一样的