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="params.type==1?'行业资讯':'政策法规'"></topNavbar> <view class="pad"> <view class="card" > <view class="li" v-for="(item,index) in listData" :key="index" @click="$goPage('/pages/indexEntry/iIndustryInfo/detail/detail?id='+item.id)"> <view class="cover"> <image :src="item.picture" mode="widthFix"></image> </view> <view class="rightCon"> <view class="h2 towRowText">{{ item.title }}</view> <view class="date">{{ $u.timeFormat(item.createTime, 'yyyy/mm/dd') }}</view> </view> </view> </view> <view style="padding-bottom: 20rpx;" v-if="listData.length>10"> <u-loadmore :status="status" /> </view> </view> </view> </template>
<script> import { getarticlezcList } from '@/config/api.js' export default { data() { return { params: { pageNo: 1, pageSize: 20, type: 1 }, listData: [], total: 20, status: 'loading', } }, onLoad(options) { this.params.type = options.type this.getarticlezcListFn() }, onPullDownRefresh() { this.listInit() }, onReachBottom() { if(this.total>this.listData.length) { this.getarticlezcListFn() } }, methods: { async listInit() { this.listData = [] this.params.pageNo = 1 await this.getarticlezcListFn() uni.stopPullDownRefresh() }, async getarticlezcListFn() { const {data: res} = await getarticlezcList(this.params) this.listData.push(...res.list) this.total = res.total if(this.listData.length>=this.total) this.status = 'nomore' console.log(res) } } } </script>
<style lang="scss" scoped> .pageBgImg { min-height: 100vh; .card { width: 100%; padding: 0 24rpx 10rpx 24rpx; .borderTop { border-bottom: 1px dashed #E8E9EC; height: 88rpx; display: flex; align-items: center; .tit { font-size: 28rpx; font-weight: 600; } } .li { display: flex; align-items: center; padding:20rpx 0; .cover { width: 184rpx; height: 148rpx; border-radius: 6rpx; overflow: hidden; } .rightCon { padding: 0 0 0 30rpx; display: flex; height: 148rpx; flex-direction: column; justify-content: space-between; flex: 1; .h2 { font-size: 24rpx; margin-top: 4rpx; } .date { font-size: 20rpx; color: #686B73; text-align: right; } } } } } </style>
|