Vue 路由使用名称进行路由切换 - 具体实现 官网
定义好路由名称后,就能用它切换页面。用 `this.$router.push` 方法,传入路由名称。示例: this.$router.push({ name: 'home' }); // 切换到名为 'home' 的路由 也能用 `this.$router.replace` 方法,它和 `push` 不同,不会在历史记录里添加新条目。示例: this.$router.replace({ name: 'about' }); // 替换当前路由为名为 'about' 的路由 提示:`push` 和 `replace` 方法使用场景不同,按需选择。