This commit is contained in:
xvv 2024-09-24 16:51:04 +08:00
parent d6b86ab8e4
commit f2d74fa386
2 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,97 @@
<template>
<view class="content">
<view class="container">
</view>
</view>
</template>
<script>
import request from '../../utils/request';
export default {
data() {
return {
title: '',
List: [],
pageNo: 1,
pageSize: 10,
totalPage: '',
}
},
onLoad() {
this.resetting() //
this.getList() //
},
onPullDownRefresh() {
//
this.resetting() //
this.getList() //
uni.stopPullDownRefresh()
},
onReachBottom() {
//
if (this.pageNo >= this.totalPage) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
} else {
this.pageNo++
this.getList()
}
},
components: {
},
methods: {
//
resetting() {
this.pageNo = 1
this.pageSize = 10
this.totalPage = ''
this.List = []
},
//
async getList() {
uni.showLoading({
title: '加载中'
});
let res = await request({
url: '网络请求',
method: 'get',
data: {
pageNo: this.pageNo,
pageSize: this.pageSize,
}
})
if (res.code == 200) {
uni.hideLoading(); //
if (this.pageNo != 1) {
this.List = this.ruleList.concat(res.result.records)
} else {
this.List = res.result.records
}
this.totalPage = res.result.pages
}
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
}
</style>

View File

@ -0,0 +1,96 @@
<template>
<view class="content">
<view class="container">
</view>
</view>
</template>
<script>
import request from '../../utils/request';
export default {
data() {
return {
title: '',
List: [],
pageNo: 1,
pageSize: 10,
totalPage: '',
}
},
onLoad() {
},
onPullDownRefresh() {
//
this.resetting() //
this.getList() //
uni.stopPullDownRefresh()
},
onReachBottom() {
//
if (this.pageNo >= this.totalPage) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
} else {
this.pageNo++
this.getList()
}
},
components: {
},
methods: {
//
resetting() {
this.pageNo = 1
this.pageSize = 10
this.totalPage = ''
this.List = []
},
//
async getList() {
uni.showLoading({
title: '加载中'
});
let res = await request({
url: '网络请求',
method: 'get',
data: {
pageNo: this.pageNo,
pageSize: this.pageSize,
}
})
if (res.code == 200) {
uni.hideLoading(); //
if (this.pageNo != 1) {
this.List = this.ruleList.concat(res.result.records)
} else {
this.List = res.result.records
}
this.totalPage = res.result.pages
}
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
}
</style>