From: Lee Date: Mon, 21 Jun 2021 08:53:06 +0000 (+0800) Subject: docs: removal of fallback option (#993) X-Git-Tag: v4.0.10~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5f16f61c27f08277ab7b538fd3d60eb5a666a02;p=thirdparty%2Fvuejs%2Frouter.git docs: removal of fallback option (#993) Co-authored-by: edison Co-authored-by: Eduardo San Martin Morote --- diff --git a/docs/guide/migration/index.md b/docs/guide/migration/index.md index 87001077..afb39245 100644 --- a/docs/guide/migration/index.md +++ b/docs/guide/migration/index.md @@ -67,6 +67,20 @@ createRouter({ }) ``` +### Removal of the `fallback` option + +The `fallback` option is no longer supported when creating the router: + +```diff +-new VueRouter({ ++createRouter({ +- fallback: false, +// other options... +}) +``` + +**Reason**: All browsers supported by Vue support the [HTML5 History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API), allowing us to avoid hacks around modifying `location.hash` and directly use `history.pushState()`. + ### Removed `*` (star or catch all) routes Catch all routes (`*`, `/*`) must now be defined using a parameter with a custom regex: diff --git a/docs/zh/guide/migration/index.md b/docs/zh/guide/migration/index.md index 0379dc8a..7bfa7a29 100644 --- a/docs/zh/guide/migration/index.md +++ b/docs/zh/guide/migration/index.md @@ -67,6 +67,20 @@ createRouter({ }) ``` +### 删除了 `RouterOptions` 中的 `fallback` 属性 + +创建路由时不再支持 `fallback` 属性: + +```diff +-new VueRouter({ ++createRouter({ +- fallback: false, +// other options... +}) +``` + +**原因**: Vue支持的所有浏览器都支持 [HTML5 History API](https://developer.mozilla.org/zh-CN/docs/Web/API/History_API),因此我们不再需要使用 `location.hash`,而可以直接使用 `history.pushState()`。 + ### 删除了 `*`(星标或通配符)路由 现在必须使用自定义的 regex 参数来定义所有路由(`*`、`/*`):