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.
|
|
<template> <view class="pageBgImg"> <topNavbar title="我的车辆"></topNavbar> <view class="pad"> <view class="searcBox"> <searchRow placeholder="搜索车牌号"></searchRow> </view> <!-- <view class="card" style="margin-bottom: 24rpx;"> <view class="add"> <view class="lab">新增车辆</view> <view class="btnBg">立即新增</view> </view> </view> --> <view class="ul"> <view class="card" v-for="(item,index) in list" :key="index"> <view class="li" > <view class="plate">{{item.licnum}}</view> <view class="name">{{item.manufacturer}}</view> </view> </view> </view> </view> <view style="padding-bottom: 20rpx;" v-if="list.length"> <u-loadmore :status="status" /> </view> <nodata v-if="!list.length&&status=='nomore'"></nodata> </view> </template>
<script> import { carPage } from '@/config/api.js' export default { data() { return { list: [], params: { pageNo: 1, pageSize: 20 }, total: 20, status: 'loading' } }, onLoad() { this.carPageFn() }, onPullDownRefresh() { this.list = [] this.params.pageNo = 1 this.carPageFn().then(()=>{uni.stopPullDownRefresh()}) }, onReachBottom() { if(this.total>this.list.length) { this.carPageFn() } }, methods: { async carPageFn() { const {data: res} = await carPage(this.params) this.params.pageNo ++ this.list.push(...res.list) this.total = res.total if(this.list.length>=this.total) this.status = 'nomore' console.log(res) } } } </script>
<style lang="scss" scoped> .searcBox { padding: 24rpx 0; } .card { margin-bottom: 20rpx; .add { display: flex; align-items: center; justify-content: space-between; height: 108rpx; padding: 0 40rpx; .lab { font-size: 32rpx; color: #333; font-weight: 500; } .btnBg { width: 192rpx; } } .li { height: 100rpx; display: flex; align-items: center; justify-content: space-between; padding: 0 24rpx; .plate { color: $themC; font-weight: 500; } .name { color: #686B73; } } } </style>
|