<scroll-view scroll-x="true" class="nav" scroll-with-animation="{{true}}">
<block wx:for="{{content.article}}" wx:for-index="idx" wx:for-item="navItem" wx:key="idx" >
<view class="nav-item {{currentTab == idx ?'active':''}}" data-current="{{idx}}" bindtap="switchNav">{{navItem.tag_name}}</view>
</block>
</scroll-view>
点击导航触发switchNav函数,但是点击初始页面的导航栏switchNav始终是第一个,点击隐藏后面的导航switchNav才能获取当前点击的导航
读了几遍都读不明白想表达什么
弄个包含js的代码片段来看看https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html