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() }