-
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
如何手动清空this.$router.param? #4032
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
@songming43 "页面跳出再次进入后" 是什么意思,页面A跳页面B,页面B点返回还是再打开新页面A。页面是普通页面还是 Tab 页面,都说详细点。 |
扫码进入A页面(Tab页面),然后A页面切换到B页面(Tab页面),再次从B页面切换到A页面,this.$router.params中的参数依然在 @Chen-jj |
@songming43 那肯定啊,B 回 A,A 页面对象都没有销毁,一直存在 |
@Chen-jj 怎么清空这个this.$router.params呢?我现在希望,仅在扫小程序码进入A页面的时候this.$router.params中的值存在,从A页面切换到B,再从B切换到A的时候this.$router.params被清空 |
@songming43 你 didmount 挂 this 上,之后想怎么做都可以。 |
@Chen-jj 怎么挂呢?
这样吗? |
@songming43 componentDidMount () {
this.parmas = this.$router.params
}
componentDidShow () {
this.params = {}
} |
Hello~ 您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。 如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。 Good luck and happy coding~ |
问题描述
使用
this.$router.params
来获取小程序码中携带的参数,但是发现在'ios设备中',this.$router.params
中的参数在生命周期中一直存在,页面跳出后,该参数一直存在。安卓设备中没有这个问题, 安卓设备中this.$router.params
中的参数只在第一次扫小程序码的时候有,页面跳出再次进入后便没有改参数。请问:如何手动清空this.$router.params
?复现步骤
期望行为
我希望再次进入页面(不通过小程序码)后,this.$router.params.store_id不要再存在了
报错信息
系统信息
补充信息
[可选]
[根据你的调查研究,出现这个问题的原因可能在哪里?]
The text was updated successfully, but these errors were encountered: