Skip to content

Commit bd84d0e

Browse files
committed
docs: note the importance of base in hash mode
Close vuejs#685
1 parent 1b62fea commit bd84d0e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

docs/api/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ export declare function createWebHashHistory(base?: string): RouterHistory
227227

228228
### Parameters
229229

230-
| Parameter | Type | Description |
231-
| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
232-
| 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**. |
230+
| Parameter | Type | Description |
231+
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
232+
| 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 |
233+
| `#`) |
233234

234235
### Examples
235236

src/history/hash.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import { warn } from '../warning'
44

55
/**
66
* Creates a hash history. Useful for web applications with no host (e.g.
7-
* `file://`) or when configuring a server to handle any URL.
7+
* `file://`) or when configuring a server to handle any URL is not possible.
88
*
99
* @param base - optional base to provide. Defaults to `___location.pathname` or
10-
* `/` if at root. If there is a `base` tag in the `head`, its value will be
11-
* **ignored**.
10+
* `/` if at root. If there is a `<base>` tag in the `head`, its value will be
11+
* ignored in favor of this parameter **but note it affects all the
12+
* history.___pushState() calls**, meaning that if you use a `<base>` tag, it's
13+
* `href` value **has to match this parameter** (ignoring anything after the
14+
* `#`).
1215
*
1316
* @example
1417
* ```js

0 commit comments

Comments
 (0)