1. 程式人生 > >小程式裡如何切換class

小程式裡如何切換class

<text wx:for="{{titles}}" wx:key="{{item}}" 

class="home-title {{index == activeIndex ? 'active' : ''}}" 

bindtap='changeClassify'> {{item.name}} </text>


 // index == activeIndex classw為 "home-title active" 否則為 "home-title "