html
<view v-for="(huadong,index) in huadongs" :key="index" :data-num="index" :class="['scroll-view-default',index==chosenum?chose:'']" @click="updateChose">{{huadong.name}}</view>
js
huadongs:[ {"name":"首页","chose":"scroll-view-chose"}, {"name":"蔬菜","chose":""}, {"name":"水果","chose":""}, {"name":"手机","chose":""}, {"name":"电脑","chose":""}, {"name":"医药","chose":""} ], chose:"scroll-view-chose", chosenum:0 updateChose(e){ this.$data.chosenum = e.currentTarget.dataset.num }
- THE END -
最后修改:2020年8月8日
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://www.95app.top/uniapp%e5%8a%a8%e6%80%81%e6%94%b9%e5%8f%98class/