omim - add omi demo

This commit is contained in:
dntzhang 2019-06-25 10:07:43 +08:00
parent bd76eb3ee2
commit 8f7847feea
3 changed files with 396 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="bundle.omi.js"></script>
</body>
</html>

View File

@ -0,0 +1,22 @@
import '../../src/icon-button/index.tsx'
import { define, WeElement, render, h } from 'omi'
define('my-app', class extends WeElement {
onChange = (evt) => {
this.result = evt.detail.isOn
this.update()
}
result = false
render() {
return <div>
<p>The switch is {this.result? 'on' : 'off'}.</p>
<m-icon-button color="red" icons={['favorite', 'favorite_border']} onChange={this.onChange}></m-icon-button>
</div>
}
})
render(<my-app />, 'body')