How to detect vue after adding routes using addRoutes () method

the following code:

this.$router.addRoutes([
  {
    path: "/temp",
    name: "Temp",
    component: () => import("@/pages/temp/Temp")
  }
])
After

has been successfully added, how can I detect the existence of Temp in the Router instance?

Mar.23,2021

// 0
let hasInstantiated = this.$router.resolve({name: 'Temp'}).route.matched.length !== 0

you can access the path corresponding to this route to see if the component is loaded properly

Menu