From fe07f04bbd30156d687b64ea6e8f1b74bb899a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BA=9A=E9=9B=84?= Date: Thu, 20 Apr 2017 15:26:33 +0800 Subject: [PATCH] modify method when pass absolute path for option.base --- dist/vue-router.common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/vue-router.common.js b/dist/vue-router.common.js index 55d0e0409..063b78f36 100644 --- a/dist/vue-router.common.js +++ b/dist/vue-router.common.js @@ -561,7 +561,9 @@ function parsePath (path) { } function cleanPath (path) { - return path.replace(/\/\//g, '/') + var ishttp = /^\w+:\/\//.exec(path); + var http = Array.isArray(ishttp) ? ishttp[0] : ''; + return http + path.substr(http.length).replace(/\/{2,}/g, '/'); } /* */ @@ -1759,7 +1761,9 @@ function normalizeBase (base) { } } // make sure there's the starting slash - if (base.charAt(0) !== '/') { + if(/^[a-z]+:\/\//i.test(base)){ + + }else if (base.charAt(0) !== '/') { base = '/' + base; } // remove trailing slash