-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.hx
53 lines (43 loc) · 1.17 KB
/
Main.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package examples.basic;
import js.Browser;
import js.html.MouseEvent;
import vmort.dom.VDom.*;
using vmort.dom.VElements;
using vmort.dom.VNodes;
class Main {
static function render(count : Int) {
}
public static function main() : Void {
var rootElement = Browser.document.getElementById("root");
var vnode1 = el("div")
.cls("test-class test-class-1 test-class-2")
.clsif(true, "class-true-1")
.clsif(false, "class-true-2", "class-false-2")
.append([
text("Some text"),
el("span").css("color", "blue").child("My span text"),
el("br"),
el("span").cssif(true, "background-color", "#ddd").child(el("input")),
el("br"),
"Hello, world!",
el("hr"),
el("button").on("click", onClick).child("Click me")
]);
trace(vnode1);
var node1 = vnode1.reify();
var vnode2 = el("div")
.append([
"My text content",
el("span")
.append([
el("input")
])
]);
var node2 = vnode2.reify();
rootElement.appendChild(node1);
rootElement.appendChild(node2);
}
static function onClick(e : MouseEvent) {
trace("click");
}
}