Skip to content

Commit 1f4ef2d

Browse files
committed
fix(IndexList): 修复点击侧边栏页面不跳转
1 parent efd45f5 commit 1f4ef2d

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

dist/index-list/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-list/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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>

examples/dist/index-list/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

examples/dist/index-list/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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>

src/index-list/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

src/index-list/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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>

0 commit comments

Comments
 (0)