2
Home

yutent edited this page 2023-09-25 18:10:07 +08:00

简单示例

app.js

// alias wkitd='//jscdn.ink/wkitd/latest/index.js'
import { css, html, createApp, createRouter, createWebHistory, createStore } from 'wkitd'


const store = createStore({
  foo: 123,
  bar: 456
})

import './views/home.js' // <wc-home />

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'wc-home'
    },
    {
      path: '/about',
      name: 'wc-about',
      component: () => import('./views/about.js')
    }
  ]
})


createApp({
  data:{},
  methods: {},
  render(){
    return html`
    <div class="app">
      <router-view></router-view>
    </div>`
  }
})
.use(store)
.use(router)
.mount()