How does nuxt.js configure routing with parameters?

nuxt.config.js overrides router:

module.exports = {
  router: {
    base: "/",
    routes: [
      {
        name: "index",
        path: "/",
        component: "pages/index.vue"
      },
      {
        name: "test",
        path: "/test(.*?)?", //path: "/test(.*?)?",
        component: "pages/test"
      },
      {
        name: "testtwo",
        path: "/testtwo",
        component: "pages/testtwo"
      }
    ],

  }
}

aim to configure that any number of params, on the route can be parsed
but: localhost:3000/test/1 cannot find the page,

Jul.04,2021

clipboard.png

refer to the official documentation, which describes in great detail ide/routing" rel=" nofollow noreferrer "> routing

Menu