总是忘,得记一下了
循环时候与进行class绑定,当begin_city_id == item.id 成立,那渲染status-true这个样式,为空则status-none
<view v-for="(item, index) in city_list" :key="index">
<view :class="{'status-true':begin_city_id == item.id}" class="route-city-name" @click="selectcity_begin(item.id)">{{item.name}}</view>
<view :class=" [begin_city_id == item.id ? 'status-true' : 'status-none']" class="route-city-name" @click="selectcity_begin(item.id)">{{item.name}}</view>
</view>