使用iview weapp組件 寫小程序 tab切換


 

wxml:

<i-row class="tab_question">
<i-col span="24" i-class="col-class">
<i-tabs current="{{ current }}" color="#f759ab" bindchange="handleChange" >
<i-tab wx:for="{{type}}"
wx:key="{{index}}"
key="tab{{index+1}}"
id="{{index}}"
title="{{item.typename}}"
>
</i-tab>
</i-tabs>
<i-cell-group wx:for="{{type}}" wx:key="{{index}}" class="right-item {{current=='tab'+(index+1) ? 'active' : ''}}">
<i-cell
wx:for="{{item.question}}"
wx:key="{{index}}"
title="{{item.question}}"
data-id="{{item.id}}"
bindtap="answerChange"
>
</i-cell>
</i-cell-group>
</i-col>
</i-row>

js:

handleChange ({ detail }) {
this.setData({
current: detail.key,
show: detail.key
});
},

css:

.right-item{display: none}
.active{display: block}


免責聲明!

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



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