File tree Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
<view class="index-list">
2
2
3
- <view wx:if="{{showSidebar}}" class="sidebar" catch:touchmove="onTouchMove" catch:touchend="onTouchend">
3
+ <view wx:if="{{showSidebar}}" class="sidebar" catch:tap="onTapSidebar" catch: touchmove="onTouchMove" catch:touchend="onTouchend">
4
4
<block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
5
5
<view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
6
6
</block>
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ Component({
405
405
this . switchTipShow ( false )
406
406
} , 300 )
407
407
this . switchIsMovingSidebar ( false )
408
+ } ,
409
+
410
+ /**
411
+ * 监听 点击侧边栏
412
+ */
413
+ onTapSidebar ( event ) {
414
+ // 把事件对象传入触摸滑动监听函数即可
415
+ this . onTouchMove ( event )
408
416
}
409
417
}
410
418
} )
Original file line number Diff line number Diff line change 1
1
<view class="index-list">
2
2
<!--Sidebar 侧栏-->
3
- <view wx:if="{{showSidebar}}" class="sidebar" catch:touchmove="onTouchMove" catch:touchend="onTouchend">
3
+ <view wx:if="{{showSidebar}}" class="sidebar" catch:tap="onTapSidebar" catch: touchmove="onTouchMove" catch:touchend="onTouchend">
4
4
<block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
5
5
<view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
6
6
</block>
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ Component({
405
405
this . switchTipShow ( false )
406
406
} , 300 )
407
407
this . switchIsMovingSidebar ( false )
408
+ } ,
409
+
410
+ /**
411
+ * 监听 点击侧边栏
412
+ */
413
+ onTapSidebar ( event ) {
414
+ // 把事件对象传入触摸滑动监听函数即可
415
+ this . onTouchMove ( event )
408
416
}
409
417
}
410
418
} )
Original file line number Diff line number Diff line change 1
1
<view class="index-list">
2
2
<!--Sidebar 侧栏-->
3
- <view wx:if="{{showSidebar}}" class="sidebar" catch:touchmove="onTouchMove" catch:touchend="onTouchend">
3
+ <view wx:if="{{showSidebar}}" class="sidebar" catch:tap="onTapSidebar" catch: touchmove="onTouchMove" catch:touchend="onTouchend">
4
4
<block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
5
5
<view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
6
6
</block>
You can’t perform that action at this time.
0 commit comments