diff --git a/package.json b/package.json index beb35f8..78fdab8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkitd", - "version": "1.3.0", + "version": "1.3.1", "type": "module", "main": "dist/index.js", "files": [ diff --git a/src/router/router-engine.js b/src/router/router-engine.js index a4b0686..f4d0bf7 100644 --- a/src/router/router-engine.js +++ b/src/router/router-engine.js @@ -99,7 +99,7 @@ class Router { let path = isHash ? hash : location.href.replace(location.origin, '').replace(hash, '') - let query + let query = '' if (path.includes('?')) { ;[path, query] = path.split('?') @@ -107,6 +107,11 @@ class Router { path = path.replace(PREFIX_REGEXP, '/') if (!$view || path === this.#route.path) { + // query不同, 只更新query + if (query !== object2query(this.#route.query)) { + this.#route.query = query2object(query) + return this.#broadcast() + } return }