[英]How does Mustache populate the variable inside the curly braces in template?
我正在调试大型Backbone Marionette应用程序,但对它来说是新手。 它还使用了我今天刚刚听到的MustacheJS。 我发现模板文件的文件名为UserProfile.mst
// This is UserProfile.mst
<div class="userProperty">
<span>{{ text.Update }}</span>
</div>
我还找到了提取此模板文件的.js文件。 实际上是RequireJS在拉动它。
define([
'UserProfile.mst'
],
function(UserViewTemplate) {
var obj = {
"userItem" : {
"template": UserViewTemplate
}
};
return obj;
});
但是,我不知道要在哪里找到文本。
填充的输入数据包含类似
text : {
"Update": "Update it!",
...
}
在http://coenraets.org/blog/2011/12/tutorial-html-templates-with-mustache-js/中检查“示例6:嵌套对象”
您可以使用点表示法来访问对象属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.