首页上拉加载

This commit is contained in:
cc_zbp 2023-06-02 09:26:13 +08:00
parent 43fa4b294b
commit 046103c5ec

View File

@ -36,7 +36,7 @@
<u-picker :defaultIndex="[0,0]" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm" <u-picker :defaultIndex="[0,0]" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm"
@cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker> @cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker>
<u-loadmore :status="status" />
<!-- <view class="bg_color"></view> --> <!-- <view class="bg_color"></view> -->
<!-- <m-tabbar native> <!-- <m-tabbar native>
@ -65,20 +65,11 @@
}, },
data() { data() {
return { return {
status: 'loadmore',
bgColor: '', bgColor: '',
showPicker: false, showPicker: false,
columnData: [], columnData: [],
show: false, show: false,
swiper: {
url: [{
img: ''
}],
indicatorDots: true, //
vertical: false, //
autoplay: true, //
interval: 2000, //
duration: 500 //
},
tabsData: { tabsData: {
list: [], list: [],
tabsActive: 0 tabsActive: 0
@ -110,6 +101,12 @@
this.Area() this.Area()
}, },
onShow() {}, onShow() {},
onReachBottom() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.where.page = ++this.where.page;
this.getGoods()
},
methods: { methods: {
confirm(e) { confirm(e) {
this.where.street_id = e.value[1].code this.where.street_id = e.value[1].code
@ -177,14 +174,12 @@
} }
}) })
}, },
dianji() {
this.show = !this.show
},
//
getGoods: function() { getGoods: function() {
// category_id=69&page=1&limit=30
graphicLstApi(this.where).then(res => { graphicLstApi(this.where).then(res => {
this.cateGoods = res.data.list this.cateGoods.push(...res.data.list)
if (res.data.list.length < this.where.limit) {
this.status == 'nomore'
}
res.data.list.length <= 0 ? this.emptyShow = true : this.emptyShow = false res.data.list.length <= 0 ? this.emptyShow = true : this.emptyShow = false
}) })
}, },