你可以使用 router.push 方法来改变路由信息,而不会跳转页面。这个方法会更新 URL 和路由状态,但不会刷新页面。

例如,在你的组件中,你可以这样使用:

export default {
  methods: {
    updateRoute() {
      this.$router.push({ path: '/new-route' })
    }
  }
}

当你调用 updateRoute 方法时,路由信息会被更新为 /new-route,但不会跳转页面。

Nuxt.js 无跳转页面更新路由信息

原文地址: https://www.cveoy.top/t/topic/l2Kf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录