<div>
<a-table
:columns="columns"
:data-source="dataSource"
:pagination="pagination"
:bordered="bordered"
:loading="loading"
:rowKey='record=>record.orgcode'
>
<template slot="slotProps"></template>
<template slot="action">
<div class="btnbox">
<a href="javascript:;" @click="deleteCharacter(record, index)">
删除
</a>
<a href="javascript:;" @click="lookUser(record, index)"> 查看 </a>
</div>
</template>
</a-table>
<a-pagination @change="onChange" :total="total" :show-total="total => `共 ${total} 条`" />
</div>
js
<script>
import { getTableInfoPost } from "./api";
const columns = [
{
title: "序号",
align:"center",
width: 100,
customRender: (text, record, index)=>{
return `${index+1}`
}
},
{
title: "orgDescEn",
align:"center",
width: "600px",
dataIndex: "orgDescEn",
key: "orgDescEn",
},
{
title: "companyName",
align:"center",
dataIndex: "companyName",
key: "companyName",
},
{
title: "orgcode",
align:"center",
dataIndex: "orgcode",
key: "orgcode",
ellipsis: true,
},
{
title: "操作",
align:"center",
key: "action",
scopedSlots: { customRender: "action" },
},
];
export default {
data() {
return {
bordered: true,
pagination:false,
loading:false,
dataSource: [],
columns,
total:0
};
},
created() {},
mounted() {
this.getFunData();
},
methods: {
async getFunData() {
this.loading = true;
let res = await getTableInfoPost(1,10);
console.log("结果", res);
if (res.data.success) {
this.loading = false;
this.dataSource = res.data.data.data;
this.total = res.data.data.total;
}
},
onChange(current){
//当前点击的页面数
console.log(current)
}
},
};
</script>