You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/components/BsChoiceGoods.vue

58 lines
1.2 KiB

3 years ago
<!--
* @Author: ch
* @Date: 2022-03-20 16:45:27
* @LastEditors: ch
3 years ago
* @LastEditTime: 2022-04-12 16:47:49
3 years ago
* @Description: file content
-->
<template>
<view>
<UiGoodsGroup :listData="listData"></UiGoodsGroup>
3 years ago
<u-loadmore :status="loadingStatus" nomoreText="我也是有底线的啦~"/>
3 years ago
</view>
</template>
<script>
import {ApiGetGoodsList} from '@/common/api/goods';
import BsEmpty from './BsEmpty.vue';
import UiGoodsGroup from './UiGoodsGroup.vue';
export default {
components: { BsEmpty, UiGoodsGroup },
data(){
return {
loadingStatus : 'loading',
listData : [],
params : {
length : 10,
pageIndex : 1
}
}
},
mounted(){
this.getGoodsList();
},
methods : {
async getGoodsList(){
this.loadingStatus = 'loading';
const query = this.$Route.query;
const {error, result} = await ApiGetGoodsList({
...this.params
});
this.listData = this.listData.concat(result.records);
// 标记是否为最后一页
if(!result.records.length < this.params.length){
3 years ago
this.loadingStatus = 'nomore';
}
},
next(){
if(this.loadingStatus === 'nomore'){
return false
}
this.params.pageIndex++;
this.getGoodsList();
}
}
}
</script>
<style lang="scss" scoped>
</style>