40 lines
1.1 KiB
HTML
40 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head lang="en">
|
|
<meta charset="UTF-8">
|
|
<title></title>
|
|
</head>
|
|
<body>
|
|
<div id="container"></div>
|
|
<a href="https://github.com/AlloyTeam/omi" target="_blank" style="position: absolute; right: 0; top: 0;">
|
|
<img src="../../asset/github.png" alt="" />
|
|
</a>
|
|
<!--[if lt IE 9]><script type="text/javascript" crossorigin="anonymous" src="//s.url.cn/qqun/xiaoqu/buluo/p/js/es5-sham-es5-sham.min.77c4325f.js"></script><![endif]-->
|
|
<script src="../../dist/omi.js"></script>
|
|
<script>
|
|
|
|
var Hello = Omi.create("Hello", {
|
|
style: function () {
|
|
return "h1{ cursor:pointer }";
|
|
},
|
|
handleClick: function (event) {
|
|
alert(event.target.innerHTML)
|
|
},
|
|
render: function () {
|
|
return ' <div><h1 onclick="handleClick">Hello ,{{name}}!</h1></div>'
|
|
}
|
|
});
|
|
|
|
var Test = Omi.create("Test", {
|
|
render: function () {
|
|
return '<div>\
|
|
<div>Test</div>\
|
|
<Hello data-name="Omi" />\
|
|
</div>'
|
|
}
|
|
});
|
|
|
|
Omi.render(new Test(),'#container');
|
|
</script>
|
|
</body>
|
|
</html> |