omi/assets/index.html

48 lines
943 B
HTML
Raw Normal View History

2018-10-17 10:15:15 +08:00
<!DOCTYPE html>
<html>
<head>
2018-10-30 06:13:12 +08:00
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<meta charset="UTF-8" />
<title>Add Omi in One Minute</title>
2018-10-17 10:15:15 +08:00
</head>
<body>
2018-12-19 16:17:30 +08:00
<script src="https://tencent.github.io/omi/packages/omi/dist/omi.min.js"></script>
2018-10-30 06:13:12 +08:00
<script>
const { WeElement, h, render, define } = Omi
define('like-button',
class extends WeElement {
install() {
this.data = { liked: false }
}
render() {
if (this.data.liked) {
return 'You liked this.'
}
return h(
'button',
{
onClick: () => {
this.data.liked = true
this.update()
2018-12-19 16:17:30 +08:00
}
2018-10-30 06:13:12 +08:00
},
'Like'
)
}
})
render(h('like-button'), 'body')
</script>
<a href="https://github.com/Tencent/omi" target="_blank" style="position: fixed; right: 0; top: 0; z-index: 3;">
<img src="//alloyteam.github.io/github.png" alt="">
</a>
2018-10-17 10:15:15 +08:00
</body>
2018-10-30 06:13:12 +08:00
</html>