使用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