Skip to content

Latest commit

 

History

History
45 lines (25 loc) · 1.1 KB

router-instance.md

File metadata and controls

45 lines (25 loc) · 1.1 KB

Router Instance

Properties

router.app

  • type: Vue instance

    The root Vue instance the router was injected into.

router.mode

  • type: string

    The mode the router is using.

router.currentRoute

  • type: Route

    The current route represented as a Route Object.

Methods

  • router.beforeEach(guard)

  • router.afterEach(hook)

    Add global navigation guards. See Navigation Guards.

  • router.push(location)

  • router.replace(location)

  • router.go(n)

  • router.back()

  • router.forward()

    Programmatically navigate to a new URL. See Programmatic Navigation.

  • router.getMatchedComponents()

    Returns an Array of the components (definition/constructor, not instances) matched by the current route. This is mostly used during server-side rendering to perform data prefetching.

  • router.resolve(location, current?, append?)

    Reverse URL resolving. Given location in form same as used in <router-link/>, returns object with string property href.