绑定对象
index2.html
<html>
<head>
<title>绑定对象</title>
<script src="jquery-1.11.2.min.js"></script>
<script src="groot.js"></script>
</head>
<body>
<div gt-view="myview">
<div gt-object="data">
姓名:<span gt-text="{name}"></span>--性别:<span gt-text="{sex}"></span><input gt-click="hello" type="button"
value="变名称">
</div>
</div>
</body>
</html>
<script>
groot.view("myview", function (vm, ve) {
vm.data = {
"name": "张三", "sex": "男"
}
ve.hello = function () {
if (vm.data.name == "张三") {
vm.data.name = "李四"
} else {
vm.data.name = "张三"
}
vm.data.nameRender();
}
})
</script>
gt-object 绑定对象