-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 优化路由接口以及修复onResize回调参数缺失的字段 #14967
Conversation
1f14ed9
to
27de8e1
Compare
3371bdb
to
37e9ab8
Compare
37e9ab8
to
4f41c13
Compare
const originPath = routesAlias.getOrigin(pathPieces.pathname) | ||
const pagePath = originPath.startsWith('/') ? originPath.substring(1) : originPath | ||
if (!RouterConfig.pages.includes(pagePath)) { | ||
const res = { errMsg: `${method}:fail page ${pagePath} is not found` } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要触发 onPageNotFound 事件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里参考了微信小程序的行为。微信小程序在用路由函数跳转到不存在的页面时,并不会触发onPageNotFound 事件,而是返回了错误信息。
packages/taro-router/src/api.ts
Outdated
fail?.(res) | ||
complete?.(res) | ||
reject(res) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果 fail 或 compete 是 function,这里应该 return resolve(res)
,反之则为 return reject(res)
,下面的 catch 中也存在类似问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
84c6ba8
to
084694f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #14967 +/- ##
==========================================
- Coverage 58.94% 58.89% -0.05%
==========================================
Files 489 489
Lines 21681 21698 +17
Branches 5556 5566 +10
==========================================
Hits 12780 12780
- Misses 7724 7741 +17
Partials 1177 1177
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢贡献~
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: