增加router-link组件
parent
248e153995
commit
6e090d0593
|
@ -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`<a class="link"><slot></slot></a>`
|
||||
}
|
||||
}
|
||||
|
||||
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(
|
||||
|
|
Loading…
Reference in New Issue