From c3b0a335f7947584a7fc37ad0b87d55fe33dd039 Mon Sep 17 00:00:00 2001 From: Dmitry Molotkov Date: Tue, 4 Sep 2018 18:04:57 +0300 Subject: [PATCH] fix: initial url path for non ascii urls (#2375) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is demo of issue https://codesandbox.io/s/m2xnyj5zx If click links withing app - active class applies fine for both links If load page on /hello - active class applies to hello link fine If load page on /тест - active class applies not applied to /тест link and the component not loaded The problem is because on initial load vue-router use window.location.pathname for path, which is uri encoded, so it wont match routes because they are not uri encoded. --- src/history/html5.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/history/html5.js b/src/history/html5.js index 95c47344c..e1cdba97d 100644 --- a/src/history/html5.js +++ b/src/history/html5.js @@ -72,7 +72,7 @@ export class HTML5History extends History { } export function getLocation (base: string): string { - let path = window.location.pathname + let path = decodeURI(window.location.pathname) if (base && path.indexOf(base) === 0) { path = path.slice(base.length) }