From cce4ab33307eb098380b509c6bad0573d9f47ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 6 Aug 2019 16:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A7=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index b14aa56..83364db 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -36,6 +36,7 @@ class Router { Anot.hideProperty(this, 'table', []) Anot.hideProperty(this, 'last', '') Anot.hideProperty(this, 'path', '') + Anot.hideProperty(this, 'pathArr', []) Anot.hideProperty(this, 'ready', false) Anot.hideProperty(this, 'noMatch', null) Anot.hideProperty( @@ -178,6 +179,7 @@ class Router { this.last = this.path this.path = path + this.pathArr = path.split('/') LINKS.forEach(vm => { if (vm.rule.test(this.path)) { vm.active = true @@ -197,6 +199,7 @@ class Router { // 跳转到路由 go(path, forceCleanHash = false) { + path = path.replace(/^[/]+/, '') let { mode, prefix } = this.options if (mode === 'hash') {