File tree Expand file tree Collapse file tree
packages/taro-platform-weapp/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,12 @@ export function initNativeApi (taro) {
2626 // 保存原始的 navigateTo 方法
2727 const originalNavigateTo = taro . navigateTo
2828
29- // 重写 navigateTo 以支持 Skyline 渲染模式
29+ /**
30+ * 重写 navigateTo 以支持 Skyline 渲染模式
31+ * 在 Skyline 模式下使用 routeType 参数时,直接调用微信原生 API,避免 Taro 运行时的动画处理导致节点查找失败
32+ * @param options - 导航参数对象
33+ * @returns Promise<any>
34+ */
3035 taro . navigateTo = function ( options : Record < string , any > ) {
3136 // 检查是否在 Skyline 模式下使用了特殊的 routeType
3237 if ( options ?. routeType && typeof wx !== 'undefined' ) {
@@ -42,13 +47,18 @@ export function initNativeApi (taro) {
4247 ...restOptions ,
4348 success : ( res ) => {
4449 success ?.( res )
50+ complete ?.( res )
4551 resolve ( res )
4652 } ,
4753 fail : ( err ) => {
48- fail ?.( err )
54+ try {
55+ fail ?.( err )
56+ } catch ( e ) {
57+ // ignore
58+ }
59+ complete ?.( err )
4960 reject ( err )
50- } ,
51- complete
61+ }
5262 } )
5363 } )
5464 }
You can’t perform that action at this time.
0 commit comments