Interfaces

ParallelRouter

interface ParallelRouter extends Router {
  // name of the parallel router
  name?: string

  // fallback settings
  fallback: {
    notFound: boolean
    index: boolean
  }

  // check if the router has the path
  hasPath: (path: string) => boolean

  // try to push the path to the router
  tryPush: (path: string, fallbackRedirect?: string) => ReturnType<Router['push']> | undefined

  // sync the parallel router with the global router
  sync: () => ReturnType<Router['push']> | undefined

  // set sync enable
  setSync: (sync: boolean) => void
}

ModalRouter

interface ModalRouter {
  /**
   * the route of the background view of the modal
   */
  route: ComputedRef<ReturnType<Router['resolve']> | undefined>

  /**
   * returns the layout of the modal route view when the modal is opened
   * must pass to NuxtLayout to prevent using wrong layout from parallel routes
   */
  layout: ComputedRef<PageMeta['layout']>

  /**
   * the route of the background view of the modal
   */
  stacks: ComputedRef<number[] | undefined>

  /**
   * Close the modal
   * @param allOpened whether to close all opened modals
   */
  close: (allOpened?: boolean) => void

  /**
   * method to push a new route to the modal
   */
  push: (to: Parameters<Router['push']>[0], open?: boolean) => ReturnType<Router['push']>

  /**
   * method to replace the current route of the modal
   */
  replace: (to: Parameters<Router['replace']>[0]) => ReturnType<Router['replace']>
}
Table of Contents