From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:51:20 +0000 (+0000) Subject: docs: mention useRouter for programmatic navigation (#2070) X-Git-Tag: v4.3.0~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7f59dbf1a434435f1d1a458bc7ac78c3c7d832f;p=thirdparty%2Fvuejs%2Frouter.git docs: mention useRouter for programmatic navigation (#2070) --- diff --git a/packages/docs/guide/essentials/navigation.md b/packages/docs/guide/essentials/navigation.md index 602ebb6f..70a8131b 100644 --- a/packages/docs/guide/essentials/navigation.md +++ b/packages/docs/guide/essentials/navigation.md @@ -13,7 +13,7 @@ Aside from using `` to create anchor tags for declarative navigatio ## Navigate to a different location -**Note: Inside of a Vue instance, you have access to the router instance as `$router`. You can therefore call `this.$router.push`.** +**Note: The examples below refer to the router instance as `router`. Inside a component, you can access the router using the `$router` property, e.g. `this.$router.push(...)`. If you're using the Composition API, the router is accessible by calling [`useRouter()`](../advanced/composition-api).** To navigate to a different URL, use `router.push`. This method pushes a new entry into the history stack, so when the user clicks the browser back button they will be taken to the previous URL.