]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: note the importance of base in hash mode
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 4 Jan 2021 10:01:13 +0000 (11:01 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 4 Jan 2021 10:01:26 +0000 (11:01 +0100)
Close #685

docs/api/index.md
src/history/hash.ts

index 06f06a27bde187fa38c84f8f8fe74a43156a0819..bd00d1cd853a4ff2275c0371ca2905e55e06ddaf 100644 (file)
@@ -227,9 +227,10 @@ export declare function createWebHashHistory(base?: string): RouterHistory
 
 ### Parameters
 
-| Parameter | Type     | Description                                                                                                                                         |
-| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-| base      | `string` | optional base to provide. Defaults to `location.pathname` or `/` if at root. If there is a `base` tag in the `head`, its value will be **ignored**. |
+| Parameter | Type     | Description                                                                                                                                                                                                                                                                                                                                                  |
+| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| base      | `string` | optional base to provide. Defaults to `location.pathname` or `/` if at root. If there is a `<base>` tag in the `head`, its value will be ignored in favor of this parameter **but note it affects all the history.pushState() calls**, meaning that if you use a `<base>` tag, its `href` value **has to match this parameter** (ignoring anything after the |
+| `#`)      |
 
 ### Examples
 
index 7efeb5e437231409476e495339e142d864404529..9768b077a4958814e1b891e1274feb8fa1b7958f 100644 (file)
@@ -4,11 +4,14 @@ import { warn } from '../warning'
 
 /**
  * Creates a hash history. Useful for web applications with no host (e.g.
- * `file://`) or when configuring a server to handle any URL.
+ * `file://`) or when configuring a server to handle any URL is not possible.
  *
  * @param base - optional base to provide. Defaults to `location.pathname` or
- * `/` if at root. If there is a `base` tag in the `head`, its value will be
- * **ignored**.
+ * `/` if at root. If there is a `<base>` tag in the `head`, its value will be
+ * ignored in favor of this parameter **but note it affects all the
+ * history.pushState() calls**, meaning that if you use a `<base>` tag, it's
+ * `href` value **has to match this parameter** (ignoring anything after the
+ * `#`).
  *
  * @example
  * ```js