From 90abaa5e402c5206e5c503b90c44aa4962357095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=96=B5?= Date: Mon, 8 Jun 2020 18:05:12 +0800 Subject: [PATCH] fix($theme-default): When use algolia search input and the hash is Chinese, the router will report an error (fix #2431) --- .../@vuepress/theme-default/components/AlgoliaSearchBox.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue b/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue index 4d51a717cb..7b2a5807cf 100644 --- a/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue +++ b/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue @@ -59,7 +59,8 @@ export default { handleSelected: (input, event, suggestion) => { const { pathname, hash } = new URL(suggestion.url) const routepath = pathname.replace(this.$site.base, '/') - this.$router.push(`${routepath}${hash}`) + const _hash = decodeURIComponent(hash) + this.$router.push(`${routepath}${_hash}`) } } ))