Authored by Aiden Xu

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -8,31 +8,48 @@
const titleFloor = require('component/resources/title-floor.vue');
const productList = require('product/list.vue');
const bus = require('common/vue-bus');
module.exports = {
data() {
return {
productList: []
productList: [],
productSkn: []
};
},
props: ['floor'],
components: {
titleFloor: titleFloor,
titleFloor,
productList
},
methods: {
getProducts(productSkn) {
if (!productSkn.length) {
return;
}
$.ajax({
url: '/channel/goods.json',
data: {
productSkn: productSkn.join(',')
}
}).then(result => {
this.productList = this.productList.concat(result);
});
}
},
created() {
let productSkn = [];
const limit = 20;
let page = 0;
this.floor.forEach(item => {
productSkn.push(item.id);
this.productSkn.push(item.id);
});
$.ajax({
url: '/channel/goods.json',
data: {
productSkn: productSkn.join(',')
}
}).then(result => {
this.productList = result;
this.getProducts(this.productSkn.slice(page, limit));
bus.$on('list.paging', () => {
page++;
this.getProducts(this.productSkn.slice(page * limit, (page + 1) * limit));
});
}
};
... ...