From bd84d0e68cf0a981fd02d201bd93397f8b695cd1 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 4 Jan 2021 11:01:13 +0100 Subject: [PATCH] docs: note the importance of base in hash mode Close #685 --- docs/api/index.md | 7 ++++--- src/history/hash.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) 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 -- 2.47.3