Update Home
parent
4295f45e79
commit
748bd7ef5a
47
Home.md
47
Home.md
|
@ -1 +1,48 @@
|
||||||
## 简单示例
|
## 简单示例
|
||||||
|
|
||||||
|
app.js
|
||||||
|
|
||||||
|
```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()
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue