1. 下拉刷新
2. 翻页到底部提示
This commit is contained in:
parent
fa45fef42e
commit
e377702b4a
@ -18,7 +18,8 @@
|
||||
{
|
||||
"path": "pages/goods_list/goods_list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品列表"
|
||||
"navigationBarTitleText": "商品列表",
|
||||
"enablePullDownRefresh":true
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -38,6 +38,8 @@
|
||||
<block v-else-if="tabsCurrent===2">
|
||||
<view class="price">价格</view>
|
||||
</block>
|
||||
<!-- 没有更多数数据提示 -->
|
||||
<view v-if="!hasMore">没有更多数据</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -72,7 +74,9 @@ export default {
|
||||
],
|
||||
tabsCurrent: 0,
|
||||
// 商品列表
|
||||
goods: []
|
||||
goods: [],
|
||||
// 在页面底部显示是否有更多数据
|
||||
hasMore: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -86,6 +90,7 @@ export default {
|
||||
// 判断有没有下一页
|
||||
if(Params.pagenum >= TotalPage){
|
||||
console.log("没有下一页数据了")
|
||||
this.hasMore = false
|
||||
uni.showToast({
|
||||
title: "没有更多数据了",
|
||||
icon:"none",
|
||||
@ -97,6 +102,15 @@ export default {
|
||||
this.getGoods()
|
||||
}
|
||||
},
|
||||
// 下拉刷新
|
||||
async onPullDownRefresh(){
|
||||
this.goods = []
|
||||
this.hasMore = false
|
||||
Params.pagenum = 1
|
||||
await this.getGoods()
|
||||
// 关闭刷新效果
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 从接口拿数据
|
||||
|
Loading…
Reference in New Issue
Block a user