Router.beforeEach(()=>{ if (to.query.IP) { next(); return; }; if (from.query.IP) { let toQuery = JSON.parse(JSON.stringify(to.query)); toQuery.abc = from.query.IP; next({ path: to.path, query: toQuery }) } else { next() } })
只需要在全局的路由守卫中添加上述代码即可实现