File tree 4 files changed +22
-2
lines changed
wx-router/miniprogram_dist
4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ history的所有API
89
89
| popTo(key)| 返回到key页|
90
90
| popToWithProps(key, newParams)| 返回到key页,并设置路由参数为newParams|
91
91
| getCurrentRoutes| 获取当前路由栈|
92
+ | switchTab| 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面|
92
93
93
94
### 4. 指定入口页
94
95
Original file line number Diff line number Diff line change @@ -109,6 +109,15 @@ class History {
109
109
}
110
110
}
111
111
}
112
+
113
+ switchTab ( routeName ) {
114
+ this . popToTop ( )
115
+ const navigateAction = NavigationActions . navigate ( {
116
+ routeName : routeName ,
117
+ } ) ;
118
+
119
+ this . dispatch ( navigateAction )
120
+ }
112
121
}
113
122
114
123
export default new History ( )
Original file line number Diff line number Diff line change @@ -105,5 +105,14 @@ export default history = {
105
105
106
106
}
107
107
}
108
- }
108
+ } ,
109
+
110
+ switchTab ( pkname , path , ) {
111
+ const fpath = `${ pkname } ${ path } `
112
+ const url = wx . _historyConfig [ fpath ]
113
+
114
+ wx . switchTab ( {
115
+ url,
116
+ } )
117
+ } ,
109
118
}
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ const historyPrefixSet = new Set([
14
14
'push' ,
15
15
'popTo' ,
16
16
'popToWithProps' ,
17
- 'replace'
17
+ 'replace' ,
18
+ 'switchTab'
18
19
] )
19
20
20
21
export default function ( ast , { isFuncComp} ) {
You can’t perform that action at this time.
0 commit comments