微信小程序,分页查询,每次查询10条数据,如何下拉到底部,请求下一次的10条数据
<template>
<!-- 搜索框 -->
<view class="tab-strickt">
<u-search v-model="keywords" @change="searchBtn" bg-color="#FFF" margin="8px" style="flex-grow: 1;"
:show-action="true" action-text="搜索" :animation="true" @custom="searchBank"></u-search>
</view>
<!-- 搜索框结束 -->
<!-- 内容开始 -->
<view v-for="(item, index) in flowList" :key="index" ref="uWaterfall1">
<view class="wai">
<view class="title">{{item.name}}</view>
<view class="title">{{item.gongsiname}}</view>
<view class="title">{{item.address}}</view>
<view class="title">{{item.detail}}</view>
<view class="title">{{item.low}}</view>
<view class="title">{{item.tall}}</view>
</view><u-line class="u-line" border-style="dashed" color="#24a8e4"></u-line>
</view>
<!-- 内容结束 -->
</template>
<script setup>
import {
getZhiweiListApi
} from '../../api/index.js'
import {
ref
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
const keywords = ref('')
const uWaterfall1 = ref()
//列表数据
const page = ref(1);
const size = ref(10);
const flowList = ref([])
const getList = async () => {
console.log(keywords.value)
let res = await getZhiweiListApi(keywords.value, page.value, size.value)
if (res && res.code == 200) {
let list = res.data.records;
flowList.value = list;
}
console.log(flowList.value)
}
//关键字搜索
const searchBtn = (e) => {}
const searchBank = () => {
console.log("搜索事件")
uWaterfall1.value = []
//获取数据
getList()
}
onLoad(() => {
getList()
})
</script>
<style>
.wai {
height: 120px;
border: 1px white solid;
margin-left: 5px;
margin-right: 5px;
}
/* 搜索框 */
.icons {
margin-right: 20px;
}
.searchk {
border: 1px #f0f0f0 solid;
width: 60%;
display: flex;
margin-top: 5px;
margin-left: 20%;
align-items: center;
justify-content: center;
border-radius: 20px;
}
.iconsearch {
width: 60%;
}
/* 搜索框结束 */
</style>