From: Eduardo San Martin Morote Date: Mon, 27 Feb 2023 13:25:32 +0000 (+0100) Subject: docs: fix dead links X-Git-Tag: v4.2.0~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3174b2a2f6f5461afe559d16a7f93054f8fb85f;p=thirdparty%2Fvuejs%2Frouter.git docs: fix dead links --- diff --git a/packages/docs/guide/advanced/dynamic-routing.md b/packages/docs/guide/advanced/dynamic-routing.md index b7512956..86fd3aac 100644 --- a/packages/docs/guide/advanced/dynamic-routing.md +++ b/packages/docs/guide/advanced/dynamic-routing.md @@ -59,23 +59,29 @@ Because we are redirecting, we are replacing the ongoing navigation, effectively There are few different ways to remove existing routes: - By adding a route with a conflicting name. If you add a route that has the same name as an existing route, it will remove the route first and then add the route: + ```js router.addRoute({ path: '/about', name: 'about', component: About }) // this will remove the previously added route because they have the same name and names are unique router.addRoute({ path: '/other', name: 'about', component: Other }) ``` + - By calling the callback returned by `router.addRoute()`: + ```js const removeRoute = router.addRoute(routeRecord) removeRoute() // removes the route if it exists ``` + This is useful when the routes do not have a name - By using `router.removeRoute()` to remove a route by its name: + ```js router.addRoute({ path: '/about', name: 'about', component: About }) // remove the route router.removeRoute('about') ``` + Note you can use `Symbol`s for names in routes if you wish to use this function but want to avoid conflicts in names. Whenever a route is removed, **all of its aliases and children** are removed with it. @@ -104,5 +110,5 @@ router.addRoute({ Vue Router gives you two functions to look at existing routes: -- [`router.hasRoute()`](../../api/interfaces/router.html#Methods-hasRoute): check if a route exists -- [`router.getRoutes()`](../../api/interfaces/Router.html#Methods-getRoutes): get an array with all the route records. +- [`router.hasRoute()`](/api/interfaces/Router.md#Methods-hasRoute): check if a route exists +- [`router.getRoutes()`](/api/interfaces/Router.md#Methods-getRoutes): get an array with all the route records. diff --git a/packages/docs/guide/essentials/history-mode.md b/packages/docs/guide/essentials/history-mode.md index 231dcaec..b46d67cc 100644 --- a/packages/docs/guide/essentials/history-mode.md +++ b/packages/docs/guide/essentials/history-mode.md @@ -68,7 +68,7 @@ While it's not recommended, you can use this mode inside Browser applications bu ### Apache -```apacheconf +``` Options -MultiViews diff --git a/packages/docs/guide/migration/index.md b/packages/docs/guide/migration/index.md index ffe7b6b1..7e226e33 100644 --- a/packages/docs/guide/migration/index.md +++ b/packages/docs/guide/migration/index.md @@ -207,7 +207,7 @@ At the moment navigation guards in mixins are not supported. You can track its s ### Removal of `router.match` and changes to `router.resolve` -Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](api/interfaces/router#Methods-resolve) for more details. +Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](/api/interfaces/Router.md#Methods-resolve) for more details. **Reason**: Uniting multiple methods that were used for the same purpose. @@ -421,10 +421,10 @@ Note this will work if `path` was `/parent/` as the relative location `home` to Decoded values in `params`, `query`, and `hash` are now consistent no matter where the navigation is initiated (older browsers will still produce unencoded `path` and `fullPath`). The initial navigation should yield the same results as in-app navigations. -Given any [normalized route location](../../api/#routelocationnormalized): +Given any [normalized route location](/api/interfaces/RouteLocationNormalized.md): - Values in `path`, `fullPath` are not decoded anymore. They will appear as provided by the browser (most browsers provide them encoded). e.g. directly writing on the address bar `https://example.com/hello world` will yield the encoded version: `https://example.com/hello%20world` and both `path` and `fullPath` will be `/hello%20world`. -- `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })` and be used directly in [scrollBehavior](../../api/#scrollbehavior)'s `el` option. +- `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })` and be used directly in [scrollBehavior](/api/interfaces/RouterOptions.md#Properties-scrollBehavior)'s `el` option. - When using `push`, `resolve`, and `replace` and providing a `string` location or a `path` property in an object, **it must be encoded** (like in the previous version). On the other hand, `params`, `query` and `hash` must be provided in its unencoded version. - The slash character (`/`) is now properly decoded inside `params` while still producing an encoded version on the URL: `%2F`. diff --git a/packages/docs/zh/guide/essentials/history-mode.md b/packages/docs/zh/guide/essentials/history-mode.md index 5a6e2ebd..24272629 100644 --- a/packages/docs/zh/guide/essentials/history-mode.md +++ b/packages/docs/zh/guide/essentials/history-mode.md @@ -51,7 +51,7 @@ const router = createRouter({ ### Apache -```apacheconf +``` Options -MultiViews diff --git a/packages/docs/zh/guide/migration/index.md b/packages/docs/zh/guide/migration/index.md index 7681052f..c3cb6eb4 100644 --- a/packages/docs/zh/guide/migration/index.md +++ b/packages/docs/zh/guide/migration/index.md @@ -207,7 +207,7 @@ app.config.globalProperties.append = (path, pathToAppend) => ### 删除 `router.match` 改为 `router.resolve` -`router.match` 和 `router.resolve` 已合并到 `router.resolve` 中,签名略有不同。[详见 API](../../api/interfaces/router#Methods-resolve)。 +`router.match` 和 `router.resolve` 已合并到 `router.resolve` 中,签名略有不同。[详见 API](/api/interfaces/Router#Methods-resolve)。 **原因**:将用于同一目的的多种方法统一起来。 @@ -412,10 +412,12 @@ const routes = [ 无论在哪里启动导航,`params`、`query`和 `hash` 中的解码值现在都是一致的(旧的浏览器仍然会产生未编码的 `path` 和 `fullPath`)。初始导航应产生与应用内部导航相同的结果。 -给定任何[规范化的路由地址](../../api/#routelocationnormalized): + -- `path`, `fullPath`中的值不再被解码了。例如,直接在地址栏上写 "https://example.com/hello world",将得到编码后的版本:"https://example.com/hello%20world",而 "path "和 "fullPath "都是"/hello%20world"。 -- `hash` 现在被解码了,这样就可以复制过来。`router.push({ hash: $route.hash })` 可以直接用于 [scrollBehavior](../../api/#scrollbehavior) 的 `el` 配置中。 +给定任何[规范化的路由地址](/api/interfaces/RouteLocationNormalized.md): + +- `path`, `fullPath`中的值不再被解码了。例如,直接在地址栏上写 " world",将得到编码后的版本:"https://example.com/hello%20world",而 "path "和 "fullPath "都是"/hello%20world"。 +- `hash` 现在被解码了,这样就可以复制过来。`router.push({ hash: $route.hash })` 可以直接用于 [scrollBehavior](/api/interfaces/RouterOptions.md#Properties-scrollBehavior) 的 `el` 配置中。 - 当使用 `push`、`resolve` 和 `replace` 并在对象中提供 `string` 地址或 `path` 属性时,**必须进行编码**(像以前的版本一样)。另一方面,`params`、`query` 和 `hash` 必须以未编码的版本提供。 - 斜线字符(`/`)现在已在 `params` 内正确解码,同时仍在 URL 上产生一个编码版本:`%2F`。