node vue如何修改进入网页时的query参数并显示在url上?
解决办法
beforeROuterEnter(to, from, next){
next(vm => {
if (from.fullPath !== '/'){ // 此处设定的条件,视情况变化,避免url无变化时$router.push的错误
vm.$router.push({
path: this.$route.path,
query: {
...this.$route.query,
from: from.fullPath,
}
})
}
})
}
该方法可用于进入网页时,保留来源于的url

浙公网安备 33010602011771号