From 9c9561cb1ce6d3647616adc268d8e826c68fb4d8 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 27 Dec 2023 16:44:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1=E6=A3=80?= =?UTF-8?q?=E6=B5=8B,=20=E8=B7=AF=E7=94=B1=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=97=B6=E4=B9=9F=E8=A7=A6=E5=8F=91=E5=9B=9E=E8=B0=83,=20?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E4=B8=8Evue-router=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/router-engine.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/router/router-engine.js b/src/router/router-engine.js index 678e013..5ac34cf 100644 --- a/src/router/router-engine.js +++ b/src/router/router-engine.js @@ -23,6 +23,7 @@ class Router { #ready = false #route = Object.create(null) + #tmp = null #beforeEach @@ -133,7 +134,6 @@ class Router { this.#exec(next) }) } - return this.#exec(next) } } @@ -142,6 +142,11 @@ class Router { $view.current = route.name this.#route = { path, name: route.name, params: {}, query: {} } this.#exec(this.#route) + } else { + if (this.#tmp) { + this.#exec(this.#tmp) + this.#tmp = null + } } } @@ -215,6 +220,8 @@ class Router { return } + this.#tmp = obj + if (this.type === MODE_HASH) { if (replace) { location.replace(path.replace(/^\//, '#/'))