From: Eduardo San Martin Morote Date: Mon, 4 Jan 2021 10:01:13 +0000 (+0100) Subject: docs: note the importance of base in hash mode X-Git-Tag: v4.0.3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd84d0e68cf0a981fd02d201bd93397f8b695cd1;p=thirdparty%2Fvuejs%2Frouter.git docs: note the importance of base in hash mode Close #685 --- diff --git a/docs/api/index.md b/docs/api/index.md index 06f06a27..bd00d1cd 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -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 `` 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 `` tag, its `href` value **has to match this parameter** (ignoring anything after the | +| `#`) | ### Examples diff --git a/src/history/hash.ts b/src/history/hash.ts index 7efeb5e4..9768b077 100644 --- a/src/history/hash.ts +++ b/src/history/hash.ts @@ -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 `` 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 `` tag, it's + * `href` value **has to match this parameter** (ignoring anything after the + * `#`). * * @example * ```js