]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: fix links and add dynamic route matching
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 15 Sep 2020 13:17:29 +0000 (15:17 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 15 Sep 2020 13:18:58 +0000 (15:18 +0200)
docs/.vitepress/config.js
docs/api/index.md
docs/guide/advanced/navigation-guards.md
docs/guide/advanced/transitions.md
docs/guide/essentials/dynamic-matching.md
docs/guide/essentials/history-mode.md
docs/guide/essentials/route-matching-syntax.md [moved from docs/guide/advanced/route-matching-syntax.md with 90% similarity]
docs/guide/index.md
docs/index.md

index 7428e39c7cd9330551c776c43b346fd472ab531f..beab4819da4e40b8678fb57424ff0d7474780f1f 100644 (file)
@@ -59,6 +59,10 @@ const config = {
                 link: '/guide/essentials/dynamic-matching',
                 text: 'Dynamic Route Matching',
               },
+              {
+                link: '/guide/essentials/route-matching-syntax',
+                text: "Routes' Matching Syntax",
+              },
               {
                 link: '/guide/essentials/nested-routes',
                 text: 'Nested Routes',
index 00ff48e6a0994d24bb3e793725a5480842880c2f..7c285b5e3965218a2d704c35bbc7d0a7a517d6ac 100644 (file)
@@ -151,6 +151,19 @@ If you add a `target="_blank"` to your `a` element, you must omit the `@click="n
 
   A route location that has all of its component resolved (if any was lazy loaded) so it can be displayed.
 
+## `<router-view>`'s `v-slot`
+
+`<router-view>` exposes a `v-slot` API mainly to wrap your route components with `<transition>` and `<keep-alive>` components.
+
+```html
+<router-view v-slot="{ Component, route }">
+  <component :is="Component" />
+</router-view>
+```
+
+- `Component`: VNodes to be passed to a `<component>`'s `is` prop.
+- `route`: resolved normalized [route location](#routelocationnormalized).
+
 ## createRouter
 
 Creates a Router instance that can be used by a Vue app. Check the [`RouterOptions`](#routeroptions) for a list of all the properties that can be passed.
index 53e557576de32a183a84ec540352119dc2bb701b..5e88c081dc9cfa29ab93fc4f86d100d5a9be9e95 100644 (file)
@@ -20,15 +20,15 @@ Global before guards are called in creation order, whenever a navigation is trig
 
 Every guard function receives two arguments:
 
-- **`to`**: the target route location [in a normalized format](../../api/#the-route-object) being navigated to.
-- **`from`**: the current route location [in a normalized format](../../api/#the-route-object) being navigated away from.
+- **`to`**: the target route location [in a normalized format](/api/#routelocationnormalized) being navigated to.
+- **`from`**: the current route location [in a normalized format](/api/#routelocationnormalized) being navigated away from.
 
 And can optionally return any of the following values:
 
 - `false`: cancel the current navigation. If the browser URL was changed (either manually by the user or via back button), it will be reset to that of the `from` route.
-- A [Route Location](../api#route-location): Redirect to a different location by passing a route location as if you were calling [`router.push()`](../api#router-push), which allows you to pass options like `replace: true` or `name: 'home'`. The current navigation is dropped and a new one is created with the same `from`.
+- A [Route Location](/api/#routelocationraw): Redirect to a different location by passing a route location as if you were calling [`router.push()`](/api/#push), which allows you to pass options like `replace: true` or `name: 'home'`. The current navigation is dropped and a new one is created with the same `from`.
 
-It's also possible to throw an `Error` if an unexpected situation was met. This will also cancel the navigation and call any callback registered via [`router.onError()`](../api#router-onerror).
+It's also possible to throw an `Error` if an unexpected situation was met. This will also cancel the navigation and call any callback registered via [`router.onError()`](/api/#onerror).
 
 If nothing, `undefined` or `true` is returned, **the navigation is validated**, and the next navigation guard is called.
 
index 0cde4b79bca3ea37e28d7a8538c0faf0dd430db7..d774ce2a126644ac73638d1235c3e71ef4328e9d 100644 (file)
@@ -1,6 +1,6 @@
 # Transitions
 
-In order to use transitions on your route components and animate navigations, you need to use the [v-slot API](../../api#v-slot):
+In order to use transitions on your route components and animate navigations, you need to use the [v-slot API](/api/#router-view-s-v-slot):
 
 ```html
 <router-view v-slot="{ Component }">
@@ -10,7 +10,7 @@ In order to use transitions on your route components and animate navigations, yo
 </router-view>
 ```
 
-[All transition APIs](https://vuejs.org/guide/transitions.html) work the same here.
+[All transition APIs](https://v3.vuejs.org/guide/transitions-enterleave.html) work the same here.
 
 ## Per-Route Transition
 
index 08618ea5d49423661238a18a436268d28481e2b0..6c4906e5ee2db14c3ce3d717c6a1c8daade76b35 100644 (file)
@@ -31,7 +31,7 @@ You can have multiple _params_ in the same route, and they will map to correspon
 | /users/:username               | /users/eduardo           | `{ username: 'eduardo' }`                |
 | /users/:username/posts/:postId | /users/eduardo/posts/123 | `{ username: 'eduardo', postId: '123' }` |
 
-In addition to `$route.params`, the `$route` object also exposes other useful information such as `$route.query` (if there is a query in the URL), `$route.hash`, etc. You can check out the full details in the [API Reference](../../api/#the-route-object).
+In addition to `$route.params`, the `$route` object also exposes other useful information such as `$route.query` (if there is a query in the URL), `$route.hash`, etc. You can check out the full details in the [API Reference](/api/#routelocationnormalized).
 
 A working demo of this example can be found [here](https://codesandbox.io/embed/objective-dew-ogjbp?initialpath=%2Fusers%2Feduardo%2Fposts%2F1).
 
@@ -103,4 +103,4 @@ If you are using [History mode](./history-mode.md), make sure to follow the inst
 
 ## Advanced Matching Patterns
 
-Vue Router uses its own path matching, inspired to the one used by `express`, so it supports many advanced matching patterns such as optional params, zero or more / one or more requirements, and even custom regex patterns. Please check the [Advanced Matching](../advanced/advanced-matching.md) documentation to explore them.
+Vue Router uses its own path matching, inspired to the one used by `express`, so it supports many advanced matching patterns such as optional params, zero or more / one or more requirements, and even custom regex patterns. Please check the [Advanced Matching](./route-matching-syntax.md) documentation to explore them.
index 2d1ed5dae9120ea12c32aa29fc2c1579e29f693b..d1c4594bb37c94f04104a0592444f67f89b19b62 100644 (file)
@@ -42,7 +42,7 @@ Not to worry: To fix the issue, all you need to do is add a simple catch-all fal
 
 ## Example Server Configurations
 
-**Note**: The following examples assume you are serving your app from the root folder. If you deploy to a subfolder, you should use [the `publicPath` option of Vue CLI](https://cli.vuejs.org/config/#publicpath) and the related [`base` property of the router](https://router.vuejs.org/api/#base). You also need to adjust the examples below to use the subfolder instead of the root folder (e.g. replacing `RewriteBase /` with `RewriteBase /name-of-your-subfolder/`).
+**Note**: The following examples assume you are serving your app from the root folder. If you deploy to a subfolder, you should use [the `publicPath` option of Vue CLI](https://cli.vuejs.org/config/#publicpath) and the related [`base` property of the router](/api/#createwebhistory). You also need to adjust the examples below to use the subfolder instead of the root folder (e.g. replacing `RewriteBase /` with `RewriteBase /name-of-your-subfolder/`).
 
 ### Apache
 
similarity index 90%
rename from docs/guide/advanced/route-matching-syntax.md
rename to docs/guide/essentials/route-matching-syntax.md
index 87e1fb662200a6f3239403e8916d0cd08a95d99f..3fe54fc6eddd542faeabb2d2da34b9cbb9f2b026 100644 (file)
@@ -1,6 +1,6 @@
 # Route Matching Syntax
 
-Most applications will use static routes like `/about` and dynamic routes like `/users/:userId`, but Vue Router has much more to offer!
+Most applications will use static routes like `/about` and dynamic routes like `/users/:userId` like we just saw in [Dynamic Route Matching](./dynamic-matching.md), but Vue Router has much more to offer!
 
 ## Custom Regexp in params
 
@@ -82,4 +82,4 @@ Note that `*` also marks the parameter as optional but cannot be repeated
 
 ## Debugging
 
-If you need to dig how your routes are transformed into Regexp to understand why a route isn't being matched or, to report a bug, you can use the [path ranker tool](https://paths.esm.dev). It supports sharing your routes through the URL.
+If you need to dig how your routes are transformed into Regexp to understand why a route isn't being matched or, to report a bug, you can use the [path ranker tool](https://paths.esm.dev/?p=AAMeJSyAwR4UbFDAFxAcAGAIJXMAAA..#). It supports sharing your routes through the URL.
index b54ee193667387b7d9900f1eef62971398dc85eb..987e8f720583fb538cc8e163ee903a03615f04a3 100644 (file)
@@ -3,7 +3,7 @@
 ::: tip Note
 We will be using [ES2015](https://github.com/lukehoban/es6features) in the code samples in the guide.
 
-Also, all examples will be using the full version of Vue to make on-the-fly template compilation possible. See more details [here](https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only).
+Also, all examples will be using the full version of Vue to make on-the-fly template compilation possible. See more details [here](https://v3.vuejs.org/guide/installation.html#runtime-compiler-vs-runtime-only).
 :::
 
 Creating a Single-page Application with Vue + Vue Router is dead simple. With Vue.js, we are already composing our application with components. When adding Vue Router to the mix, all we need to do is map our components to the routes and let Vue Router know where to render them. Here's a basic example:
index 836d2177897e200dd5fb04677df677ebf312c47a..afb30ecefe51ebb27bb3de66884b1bea986d7667 100644 (file)
@@ -1,6 +1,6 @@
 # Introduction
 
-Vue Router is the official router for [Vue.js](http://vuejs.org). It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. Features include:
+Vue Router is the official router for [Vue.js](http://v3.vuejs.org). It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. Features include:
 
 - Nested routes mapping
 - Dynamic Routing
@@ -13,4 +13,4 @@ Vue Router is the official router for [Vue.js](http://vuejs.org). It deeply inte
 - Customizable Scroll Behavior
 - Proper encoding for URLs
 
-[Get started](./guide/) or play with the [playground](https://github.com/vuejs/vue-router-next/tree/master/playground) (see [`README.md`](https://github.com/vuejs/vue-router-next) to run them).
+[Get started](/guide/) or play with the [playground](https://github.com/vuejs/vue-router-next/tree/master/playground) (see [`README.md`](https://github.com/vuejs/vue-router-next) to run them).