增加router-link组件
parent
248e153995
commit
6e090d0593
|
@ -11,7 +11,7 @@ import createWebHistory from './modern-router.js'
|
||||||
|
|
||||||
export { createWebHashHistory, createWebHistory }
|
export { createWebHashHistory, createWebHistory }
|
||||||
|
|
||||||
class Router extends Component {
|
class RouterView extends Component {
|
||||||
static props = {
|
static props = {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
transition: false,
|
transition: false,
|
||||||
|
@ -78,8 +78,18 @@ class Router extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RouterLink extends Component {
|
||||||
|
render() {
|
||||||
|
return html`<a class="link"><slot></slot></a>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!customElements.get('router-view')) {
|
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(
|
export function createRouter(
|
||||||
|
|
Loading…
Reference in New Issue