Vue tips

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