-
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
feat(h5): Router解析出来的params供赋值给getCurrentInstance()?.router?.params #11545
Conversation
…PageConfig获取到后赋值给options
这并不是一个新功能,更新到最新版本已有该特性 |
抱歉,我刚更新到3.4.7版本测试了一下,然后又趴了最新的代码看了,并没看到哪里会怕路由上解析出来的参数传出来。 |
抱歉,之前理解错了 😂 |
不过这个功能实现也会在下一个版本上 |
多谢 :) |
2a495f9
to
b9efe4c
Compare
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 做了什么? (简要描述所做更改)
问题:
H5上类似 “'/swift/:regionType/:dcity/:acity/:ddate'” 这种路由能够被Router解析出来,但是解析出来的参数无法获取到。
解决方案:
修改taro-loader生成H5的路由代码中load 增加返回参数routerContext 和routerParams
修改taro-router获取到routerContext 和routerParams 后传递给createPageConfig并赋值给options
现有代码上PageConfig的options会赋值给getQuery函数最终能够通过 getCurrentInstance()?.router?.params 获取到
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: