File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<view class="index-list">
22
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">
44 <block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
55 <view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
66 </block>
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ Component({
405405 this . switchTipShow ( false )
406406 } , 300 )
407407 this . switchIsMovingSidebar ( false )
408+ } ,
409+
410+ /**
411+ * 监听 点击侧边栏
412+ */
413+ onTapSidebar ( event ) {
414+ // 把事件对象传入触摸滑动监听函数即可
415+ this . onTouchMove ( event )
408416 }
409417 }
410418} )
Original file line number Diff line number Diff line change 11<view class="index-list">
22 <!--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">
44 <block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
55 <view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
66 </block>
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ Component({
405405 this . switchTipShow ( false )
406406 } , 300 )
407407 this . switchIsMovingSidebar ( false )
408+ } ,
409+
410+ /**
411+ * 监听 点击侧边栏
412+ */
413+ onTapSidebar ( event ) {
414+ // 把事件对象传入触摸滑动监听函数即可
415+ this . onTouchMove ( event )
408416 }
409417 }
410418} )
Original file line number Diff line number Diff line change 11<view class="index-list">
22 <!--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">
44 <block wx:for="{{sidebarData}}" wx:for-item="sidebarItem" wx:key="index">
55 <view class="sidebar-item l-sidebar-class {{activeSidebarItem===index?'sidebar-item-active l-selected-class':'l-unselected-class'}}">{{sidebarItem}}</view>
66 </block>
You can’t perform that action at this time.
0 commit comments