在APP.vue里面
mounted里面(最前面)
console.log(this.$route.query.source)第一次代码运行完成后能打印值,
后面刷新页面一直打印不了,也存了缓存
但是打印不出来,后来找到原因是
route.js并没有执行完毕console就打印出来了,
所以
this.$router.onReady(() => {
if(this.$route.query.source != undefined && this.$route.query.source != null){
localStorage.setItem("source",this.$route.query.source)
}
})
加上 this.$router.onReady(() => {这样就取到数值了