From 91059278eb75ac5b5f3cbb83a6d8658f3363a823 Mon Sep 17 00:00:00 2001 From: hanquliu Date: Thu, 18 Nov 2021 19:23:51 +0800 Subject: [PATCH] fix: #907 --- packages/history/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/history/index.ts b/packages/history/index.ts index 7106198a..4a66d29c 100644 --- a/packages/history/index.ts +++ b/packages/history/index.ts @@ -1049,6 +1049,9 @@ export function createPath({ search = '', hash = '' }: PartialPath) { + if (hash && hash !== '#') { + hash = hash.charAt(0) === '#' ? hash : `#${hash}`; + } return pathname + search + hash; }