• 移动端表格分页uni-app


    使用uni-app提供的uni-table表格
    网址:https://uniapp.dcloud.net.cn/component/uniui/uni-table.html#%E4%BB%8B%E7%BB%8D

    <uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
    	@selection-change="selectionChange">
    		<uni-tr>
    			<uni-th width="100" align="center">资产名称uni-th>
    			<uni-th width="90" align="center">资产类别uni-th>
    			<uni-th width="80" align="center">原使用部门uni-th>
    			<uni-th width="50" align="center">操作uni-th>
    		uni-tr>
    		<uni-tr v-for="(item, index) in shenpilist" :key="index" :label="item.name" :name="item.name">
    			<uni-td align="center">{{ item.assetName }}uni-td>
    			<uni-td align="center">{{ item.categoryName }}uni-td>
    			<uni-td align="center">{{ item.deptName }}uni-td>
    			<uni-td align="center">
    				<button class="uni-button" size="mini" type="primary" @click="onModalState(item)">详情button>
    			uni-td>
    		uni-tr>
    	uni-table>
    <view class="uni-pagination-box"><uni-pagination show-icon  :current="queryParams.pageNum"
     :total="total" @change="change" />view>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    import {getAssets} from '@/api/subpkg/index.js'
    export default {
    		data() {
    			return {
    			// 列表数据
    			shenpilist: [],
    			// 参数列表
    			queryParams: {
    				pageNum: 1,
    				pageSize: 10,
    				category: undefined,
    				assetCode: '',
    				assetName: '',
    			},
    			total: null,//总数据
    			}
    		},
    		methods:{
    			async getAssets() {
    				const data = {
    					isForceAllocate: this.value.indexOf('是否强制调拨') !== -1 ? 1 : 0,
    					query: this.queryParams
    				}
    				const res = await getAssets(data)
    				uni.hideLoading()
    				this.shenpilist = res.rows
    				this.total = res.total; 
    				console.log(this.total);
    			},
    			// 分页触发
    			change(e) {
    			console.log(e.current);
    				this.queryParams.pageNum = e.current;
    				uni.showLoading({
    					title: '数据加载中',
    					mask: true,
    				});
    				//分页切换之后,在发一次请求,使数据更新
    				this.getAssets()
    			},
    		}
      }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42

    在这里插入图片描述

  • 相关阅读:
    Arrays 中的 asList()方法
    复制对象耗时比较(PO2Response)
    类与对象(上)
    Spring面试题(2022)
    【vue组件封装】根据页面滚动高亮显示目录的侧边栏
    我发论文啦系列之一《融合FY-3C号和FY-4A号卫星数据的积雪面积变化研究—以祁连山区为例》
    【Leetcode】190.颠倒二进制位
    go实现限流器
    JUC-无锁
    linux上安装bluesky的步骤
  • 原文地址:https://blog.csdn.net/weixin_59527403/article/details/134479774