...
|
...
|
@@ -103,26 +103,32 @@ module.exports = function(data) { |
|
|
var loadAjax;
|
|
|
var url = data.url;
|
|
|
|
|
|
data.pageIndex=0;
|
|
|
|
|
|
delete data.url;
|
|
|
|
|
|
loadAjax = function(url, data, count) {
|
|
|
|
|
|
data.pageIndex++;
|
|
|
|
|
|
var options = {
|
|
|
type: 'POST',
|
|
|
url: url,
|
|
|
data: data,
|
|
|
success: function(data) {
|
|
|
var code = data.code;
|
|
|
success: function(result) {
|
|
|
var code = result.code;
|
|
|
var myTemplate,len,pos;
|
|
|
|
|
|
if (code === 200) {
|
|
|
len = data.goods.length % count;
|
|
|
pos = data.goods.length - len - 1;
|
|
|
len = result.goods.length % count;
|
|
|
pos = result.goods.length - len - 1;
|
|
|
|
|
|
data.goods.splice(pos, len);
|
|
|
result.goods.splice(pos, len);
|
|
|
|
|
|
myTemplate = Handlebars.compile(load.tpl);
|
|
|
|
|
|
$container.append(myTemplate(data.goods));
|
|
|
$container.append(myTemplate(result.goods));
|
|
|
data.pageIndex += result.goods.length;
|
|
|
|
|
|
//懒加载插件貌似有点问题,图片先直接展示
|
|
|
lazyload($container.find('img.lazy'));
|
...
|
...
|
@@ -146,10 +152,6 @@ module.exports = function(data) { |
|
|
|
|
|
|
|
|
load.on('after', function(p) {
|
|
|
data = $.extend({}, data, {
|
|
|
pageIndex: p.index
|
|
|
});
|
|
|
|
|
|
|
|
|
data.pageCount = data.count * data.rows[1];
|
|
|
|
...
|
...
|
@@ -212,10 +214,6 @@ module.exports = function(data) { |
|
|
load.tpl += '</div>';
|
|
|
load.tpl += '{{/each}}';
|
|
|
|
|
|
data = $.extend({}, data, {
|
|
|
pageIndex: p.index
|
|
|
});
|
|
|
|
|
|
|
|
|
data.pageCount = data.count * data.rows[0];
|
|
|
|
...
|
...
|
|