귀속 템플릿, 귀속 트리
3618 단어 귀속
<html>
<head>
<title>ui </title>
<script src="jquery-1.11.2.min.js"></script>
<script src="groot.js"></script>
</head>
<body>
<div gt-view="myview">
<ul gt-each="list" gt-include="./templ2.html">
</ul>
</div>
</body>
</html>
<script>
require("./ui");
groot.view("myview", function (vm, ve) {
vm.list = [
{
dept: " ",
depts: [
{
dept: " ",
depts:[],
member: [
{name: " ", sex: " "}
,
{name: " ", sex: " "}
,
{name: " ", sex: " "}
]
}, {
dept: " ",
depts:[],
member: [
{name: " ", sex: " "}
,
{"name": " ", sex: " "}
,
{name: " ", sex: " "}
]
}
],
member: [
{name: " ", sex: " "}
,
{name: " ", sex: " "}
,
{name: " ", sex: " "}
]
},
{
dept: " ",
depts: [],
member: [
{name: " ", sex: " "}
,
{name: " ", sex: " "}
,
{name: " ", sex: " "}]
}
];
})
</script>
모형
<li>
<span gt-text="{dept}"></span>
<ul gt-each="member">
<li><span gt-text="{name}+'--'+{sex}"></span></li>
</ul>
<ul gt-each="depts" gt-include="./templ2.html">
</ul>
</li>