48 lines
1004 B
HTML
Executable File
48 lines
1004 B
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
|
<meta charset="UTF-8" />
|
|
<title>Add Omi in One Minute</title>
|
|
</head>
|
|
|
|
<body>
|
|
<script src="https://unpkg.com/omi"></script>
|
|
<script>
|
|
const { WeElement, h, render, define } = Omi
|
|
|
|
class LikeButton 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()
|
|
}
|
|
},
|
|
'Like'
|
|
)
|
|
}
|
|
}
|
|
|
|
define('like-button', LikeButton)
|
|
|
|
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>
|
|
</body>
|
|
|
|
</html> |