<view class="city-list">
<view v-for="(item,index) in listsCities" :key="index" class="city"
:class="{'on':selectCity == item.title}">
<text @tap="cityOnClick(item)" class="hot-text">{{item.title}}</text>
</view>
</view>
:class=“” 里面是用{}括起来
on的样式
.city {
width: 140upx;
height: 50upx;
flex-direction: row;
display: flex;
background-color: #F5F6F8;
margin: 20upx;
justify-content: center;
align-items: center;
text {
color: #111;
}
&.on {
background-color: #4180e9;
text {
color: #fff;
}
}
}
使用&符号处理