vue-infinite-scroll
具体网址(https://www.npmjs.com/package/vue-infinite-scroll)
使用
|
|
|
|
要定义的事项
- 定义busy data(){return {busy:false}}
- 定义loadMore方法 1234567891011121314151617181920212223242526272829303132333435363738394041loadMore: function() {this.busy = true;this.loadding = true;setTimeout(() => {this.page++; //改变参数this.getGoodslist(true); //请求数据}, 500);}getGoodslist(flag){var param = {page: this.page,pageSize:this.pageSize,sort:this.sortFlag?1:-1,priceLevel:this.nowIndex}axios.get('/goods/list',{params:param}).then((response)=>{response = response.data;if(response.status == 0){this.loading =true;if(flag){this.goods = this.goods.concat(response.result.list);if(response.result.count == 0){this.busy = true;this.loading =false;}else{this.busy = false;}}else{this.goods = response.result.list;this.busy = false;}}else{this.goods = [];}})}
|
|