APP.templates = (function () {
'use strict';
function application() {
}
function home() {
return '<button id="refreshButton">刷新新闻</button><div id="headlines"></div></div>';
}
function articleList(articles) {
var i, l, output = '';
if (!articles.length) {
}
for (i = 0, l = articles.length; i < l; i = i + 1) {
}
return '<ul>' + output + '</ul>';
}
function article(articles) {
}
return '<a href="#">回到首页</a><h2>' + articles[0].headline + '</h2><h3>作者:' + articles[0].author + ' ,发表日期:' + articles[0].date + '</h3>' + articles[0].body;
}
function articleLoading() {
return '<a href="#">回到首页</a><br /><br />Please wait…';
}
return {
application: application,
home: home,
articleList: articleList,
article: article,
articleLoading: articleLoading
};
}());
APP.templates = (function () {})这个结构该怎么理解呢?为什么前面这个APP.templates不用审明呢?
还有最下面的段:
return {
application: application,
home: home,
articleList: articleList,
article: article,
articleLoading: articleLoading
};
怎么理解呢?前后两个(比如 application: application中前面和后面的)分别是什么意思呢?
相关分类