|
unction getRestData(type) {
api.showProgress({
title: '加载中...',
modal: false
});
var getMerchantUrl = '/merchant?filter=';
var urlParam = {
include: ["", "", ""],
where:{category:type}
};
ajaxRequest(getMerchantUrl + JSON.stringify(urlParam), 'GET', '', function (ret, err) {
if (ret) {
var content = $api.byId('lifeList');
var tpl = $api.byId('act-template').text;
var tempFn = doT.template(tpl);
content.innerHTML = tempFn(ret);
api.refreshHeaderLoadDone();
api.parseTapmode();
} else {
api.toast({msg: err.msg, location: 'middle'})
}
api.hideProgress();
})
}
<script id="act-template" type="text/x-dot-template">
{{ for(var i=0, len=it.length; i < len; i++) {}}
<li>
<a tapmode="active" data-id="{{=it.id}}" onclick="openRest(this);">
<img src="{{=it.img.url}}" />
<h3>{{=it.name}}</h3>
<div class="info clearfix">
<span>{{=it.city.name}}</span>
<span>{{=it.type.name}}</span>
<!--<em>120km</em>-->
</div>
</a>
</li>
{{ } }}
</script>
其中的 <span>{{=it.city.name}}</span>
<span>{{=it.type.name}}</span>这两行不懂 谢谢了 |
|