123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <view class="container">
- <uni-card :title="istitle" class="cardBox">
- <uni-list border class="list">
- <uni-list-item v-for="(item, index) in dataList" :key="index" :note="item.note" :ellipsis="1" :title="item.title" link clickable @click="listItemBtn(item)" ></uni-list-item>
- </uni-list>
- <uni-load-more :status="more" />
- </uni-card>
- </view>
- </template>
- <script>
- import request from '../../api/cms.js';
- export default {
- onLoad: function (option) {
-
- },
- data() {
- return {
- dataList: [],
- more: 'more',
- page: 0,
- size: 20
- }
- },
- async mounted() {
- await this.getList();
- },
- methods: {
- listItemBtn(e) {
- uni.navigateTo({ url: `/pages/details/cmsinfo?id=${e.id}` });
- },
- // 查询列表函数
- async getList() {
- this.page += 1;
- this.more = 'loading';
- const res = await request.getArticleList({ pageNum: this.page, pageSize: this.size, typeName: 'jzdcx' });
- this.dataList.push(...res.rows)
- // 根据总数 算页数 如果当前页 = 总页数就是没有数据 否则就是上拉加载
- this.more = this.page >= Math.ceil(res.total / this.size) ? 'noMore' : 'more';
- },
- },
- // 页面生命周期中onReachBottom(页面滚动到底部的事件)
- onReachBottom() {
- if(this.more != 'noMore') {
- this.more = 'more';
- this.getList();
- }
- }
- }
- </script>
- <style>
- </style>
|