- vue + antd 使用 antd的表格组件,并在表格最后一列添加操作列
- 第一步 在cloumns 中添加
{
title: 'AOD File',
dataIndex: 'operation',
scopedSlots: { customRender: 'operation' },
width: 160
}
- 第二步 写一个插槽 slot 的值和第一步中的dataIndex对应
<a-table :columns="columns" :data-source="data" :pagination="pagination" @change="handleTableChange" :loading="loading">
<template slot="operation" slot-scope="text, record">
<a :href="'/TEData/Download?param1='+ record.param1+'¶m2='+ record.param2">连接</a>
</template>
</a-table>
2. 配置分页
- 在data中配置分页插件的一些属性值如:总共多少条数据、当前页、每页多少条数据、是否需要改变每页数据条数的组件、是否需要跳转页码的组件 onShowSizeChange是当页面数据条数发生改变的时候触发的事件、onChange()是页面跳转时触发的事件
pagination: {
total: 0,
current: 1,
pageSize: 10,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize),
onChange: (page, pageSize) => this.onPageChange(page, pageSize)
},
3.配置表格加载: :loading="loading" loading 为true 显示加载状态,loading=false 停止加载