我正在练习使用髭js通过使用语义应用程序来开发一个简单的Web应用程序。但是,似乎我的代码未返回任何内容。
PS: 我再次检查了Chrome控制台。没有错误日志 js文件链接和语义文件链接没有错误
test.js
var CardField = [{
Name: "Li",
Member: "1"
},
{
Name: "Jia",
Member: "2"
},
{
Name: "tong",
Member: "3"
}
]
var template = document.getElementById("justatest").innerHTML;
var rendered = Mustache.render(template, CardField);
$('justatest').html(rendered);
html中的script标签
<script src="../../test.js" type="x-tmpl-mustache" id="justatest">
{{#CardField}}
<div class="ui card">
<div class="ui slide masked reveal image">
<img src="/images/avatar/large/jenny.jpg" class="visible content">
<img src="/images/avatar/large/elliot.jpg" class="hidden content">
</div>
<div class="content">
<a class="header">{{Name}}</a>
<div class="meta">
<span class="date">Created in Sep 2014</span>
</div>
</div>
<div class="extra content">
<i class="users icon"></i>
{{Member}}
</div>
</div>
{{/CardField}}
</script>