]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: removal of fallback option (#993)
authorLee <peterlee@apache.org>
Mon, 21 Jun 2021 08:53:06 +0000 (16:53 +0800)
committerGitHub <noreply@github.com>
Mon, 21 Jun 2021 08:53:06 +0000 (10:53 +0200)
Co-authored-by: edison <daiwei521@126.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
docs/guide/migration/index.md
docs/zh/guide/migration/index.md

index 870010770e8d57bc0f1a26fbe3648051a344ced5..afb39245d523b4f01ec093b44f09b48bb52c2c5e 100644 (file)
@@ -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:
index 0379dc8ad5f3aa7345f92ea6ce4c22e3c8d7c81b..7bfa7a29a07e9bcf5ad4ed5177fa5564487e5e2c 100644 (file)
@@ -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 参数来定义所有路由(`*`、`/*`):