0.1.7 • Published 1 year ago

vilex-router v0.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago
import { createRouter, router } from 'vilex-router'
import { div, button, createApp } from 'vilex'
import { customRouterView, regRoute, routerView } from 'vilex-router'

function App() {
  return div(
    routerView(
      regRoute('/', () => div('/ route content')),
      regRoute('/default-1', () => div('default-1 route content')),
      regRoute('/default-2', () => div('default-2 route content'))
    ),
    customRouterView(
      () => div({ height: '200px' }),
      regRoute('/custom-1', () => div('custom-1 route content')),
      regRoute('/custom-2', () => div('custom-2 route content'))
    ),
    div(
      ['default-1', 'default-2', 'custom-1', 'custom-2'].map((item) =>
        button(`to ${item}`, {
          onclick() {
            router.push(`/${item}`)
          },
        })
      )
    )
  )
}

createApp(App).use(createRouter()).mount('#app')

document: https://vilex.github.io

0.1.7

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago