From 4a1287618666f7f93425acafd94e43f86a0fd4a7 Mon Sep 17 00:00:00 2001 From: dntzhang Date: Tue, 20 Nov 2018 17:01:02 +0800 Subject: [PATCH] update readme --- packages/omi-30-seconds/README.md | 43 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/packages/omi-30-seconds/README.md b/packages/omi-30-seconds/README.md index d7f193ba3..a9108708f 100644 --- a/packages/omi-30-seconds/README.md +++ b/packages/omi-30-seconds/README.md @@ -96,33 +96,34 @@ Using mitt in omi project: import mitt from 'mitt' import { render, WeElement, define } from 'omi' -define('child-ele', function(props) { - onClick = () => { - this.store.emitter.emit('foo', { a: 'b' }) - } - - return ( -
- child-ele +define('child-ele', class extends WeElement { + onClick = () => { + this.store.emitter.emit('foo', { a: 'b' }) + } + render() { + return ( +
+ child-ele
- ) + ) + } }) -define('todo-app', class extends WeElement { +define('my-app', class extends WeElement { - install(){ - this.store.emitter.on('foo', e => console.log('foo', e) ) - } + install() { + this.store.emitter.on('foo', e => console.log('foo', e)) + } - render() { - return ( -
- -
- ) - } + render() { + return ( +
+ +
+ ) + } }) -render(, 'body', { emitter: mitt() }) +render(, 'body', { emitter: mitt() }) ```