小程序class&style和三元表達式的結合使用


class:

<view class="tab-item {{currentTab==0 ? 'on' : ''}}" >我要取票</view>
 
style:
 
<view  current="{{currentTab}}"  style="height:{{currentTab==1?Height+'rpx':'100%'}}">我要取票</view>
 
提示:
 
1.currentTab,Height為data中的數據
 
2.紅色為區別部分


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM