File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 <view class =" uni-tab-bar" >
33 <scroll-view id =" tab-bar" class =" uni-swiper-tab" scroll-x :scroll-left =" scrollLeft" >
44 <view v-for =" (tab,index) in tabBars" :key =" tab.id" :class =" ['swiper-tab-list',tabIndex==index ? 'active' : '']"
5- :id =" tab.id" :data-current =" index" @tap =" tapTab" >{{tab.name}}</view >
5+ :id =" tab.id" :data-current =" index" @click =" tapTab(index) " >{{tab.name}}</view >
66 </scroll-view >
77 <swiper :current =" tabIndex" class =" swiper-box" duration =" 300" @change =" changeTab" >
88 <swiper-item v-for =" (tab,index1) in newsitems" :key =" index1" >
154154 this .newsitems [e].loadingType = 1 ;
155155 },
156156 async changeTab (e ) {
157- let index = e .target .current ;
157+ let index = e .detail .current ;
158158 if (this .isClickChange ) {
159159 this .tabIndex = index;
160160 this .isClickChange = false ;
190190 }).exec ();
191191 })
192192 },
193- async tapTab (e ) { // 点击tab-bar
194- if (this .tabIndex === e . target . dataset . current ) {
193+ async tapTab (index ) { // 点击tab-bar
194+ if (this .tabIndex === index ) {
195195 return false ;
196196 } else {
197197 let tabBar = await this .getElSize (" tab-bar" ),
198198 tabBarScrollLeft = tabBar .scrollLeft ; // 点击的时候记录并设置scrollLeft
199199 this .scrollLeft = tabBarScrollLeft;
200200 this .isClickChange = true ;
201- this .tabIndex = e . target . dataset . current
201+ this .tabIndex = index;
202202 }
203203 },
204204 randomfn () {
You can’t perform that action at this time.
0 commit comments