[Vuejs]-Make Vue.js router to match only numbers

0👍

Try this.

{
      path: '/user/:id',
      name: "RouteName",
      component: SomeComponent,
      props: (route) => {
        const id= Number.parseInt(route.params.id, 10)
        if (Number.isNaN(id)) {
          return 0
        }
        return { id }
      }
    }

Leave a comment