Vue js, “route object” type?

  Kiến thức lập trình

How do you get the actual ‘route object’ type for a ts build.

route object

I’m following the the nuxt guide below and can’t figure out how to get the Route object so I don’t get the ts implicit any type warning on the to and from parameters`.

export default defineNuxtRouteMiddleware((to, from) => {
  if (to.params.id === '1') {
    return abortNavigation()
  }
  // In a real app you would probably not redirect every route to `/`
  // however it is important to check `to.path` before redirecting or you
  // might get an infinite redirect loop
  if (to.path !== '/') {
    return navigateTo('/')
  }
})

Nuxt Guide

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT