赞
踩
在项目中,我们经常需要将参数拼接到地址栏上,以便请求接口的时候拿到所需要的入参。在vue中,我们可以使用this.$router.replace()方法将我们所需要拼接的参数替换到地址栏上。
记录的使用时遇到的问题
原因
- ` this.$router.replace({
...this.$route,
query: {
...this.$route.query,
index: resp.data.result[0].id,
lookupType: resp.data.result[0].lookupType
}
})`
…this. r o u t e r 与 . . . t h i s . router与...this. router与...this.router.query遍历原有的路由拼接加上地址栏,就可以解决重复加载问题
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。