Vue tips
- Vue的生命周期中,
$rounter
可能在created
和mounted
阶段并没有初始化好,这时使用push
或者replace
是无效的,这时我们可以使用这个方法来解决这个问题:
this.queryParams = this.$route.query
this.$router.onReady(() => {
this.$router.push({ query })
})
$rounter
可能在 created
和 mounted
阶段并没有初始化好,这时使用 push
或者 replace
是无效的,这时我们可以使用这个方法来解决这个问题:this.queryParams = this.$route.query
this.$router.onReady(() => {
this.$router.push({ query })
})