From a1c1740166104ec30a937256014ff6ce61881ba6 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 9 May 2024 16:15:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B7=AF=E7=94=B1=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/router/router-engine.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ab33ae..4744f89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkitd", - "version": "1.3.6", + "version": "1.3.7", "type": "module", "main": "dist/index.js", "files": [ diff --git a/src/router/router-engine.js b/src/router/router-engine.js index 25c8b07..59d4fce 100644 --- a/src/router/router-engine.js +++ b/src/router/router-engine.js @@ -152,8 +152,16 @@ class Router { #exec(route) { let $view = window.wkitd.get(__ROUTER_VIEW__) + let table = this.#tables.get(route.path) $view.current = route.name this.#route = route + + if (typeof table.component === 'function') { + if (!customElements.get(route.name)) { + table.component() + delete table.component //避免多次请求 + } + } this.#broadcast() }