From 6e090d0593242857094188aeb82beece8cb834ec Mon Sep 17 00:00:00 2001 From: yutent Date: Sat, 12 Aug 2023 23:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0router-link=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 66e0b56..1600ad8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,7 +11,7 @@ import createWebHistory from './modern-router.js' export { createWebHashHistory, createWebHistory } -class Router extends Component { +class RouterView extends Component { static props = { keepAlive: false, transition: false, @@ -78,8 +78,18 @@ class Router extends Component { } } +class RouterLink extends Component { + render() { + return html`` + } +} + if (!customElements.get('router-view')) { - customElements.define('router-view', Router) + customElements.define('router-view', RouterView) +} + +if (!customElements.get('router-link')) { + customElements.define('router-link', RouterLink) } export function createRouter(