[英]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.