docs: update omi docs

This commit is contained in:
dntzhang 2019-10-07 14:27:51 +08:00
parent 2412f4f6f2
commit 37f8040a6e
3 changed files with 9 additions and 4 deletions

View File

@ -16,14 +16,13 @@ For example:
import { render, WeElement, define } from 'omi'
define('my-timer', class extends WeElement {
static observe = true
data = {
seconds: 0
}
tick() {
this.data.seconds++
this.update()
}
install() {

View File

@ -34,7 +34,6 @@ import './user'
import './user-list'
define('my-app', class extends WeElement {
static observe = true
data = { tag: 'my-home' }
@ -42,20 +41,24 @@ define('my-app', class extends WeElement {
route('/', () => {
this.data.tag = 'my-home'
this.update()
})
route('/about', (evt) => {
console.log(evt.query)
this.data.tag = 'my-about'
this.update()
})
route('/user-list', () => {
this.data.tag = 'user-list'
this.update()
})
route('/user/:name/category/:category', (evt) => {
this.data.tag = 'my-user'
this.data.params = evt.params
this.update()
})
route('*', function () {

View File

@ -34,7 +34,6 @@ import './user'
import './user-list'
define('my-app', class extends WeElement {
static observe = true
data = { tag: 'my-home' }
@ -42,20 +41,24 @@ define('my-app', class extends WeElement {
route('/', () => {
this.data.tag = 'my-home'
this.update()
})
route('/about', (evt) => {
console.log(evt.query)
this.data.tag = 'my-about'
this.update()
})
route('/user-list', () => {
this.data.tag = 'user-list'
this.update()
})
route('/user/:name/category/:category', (evt) => {
this.data.tag = 'my-user'
this.data.params = evt.params
this.update()
})
route('*', function () {