<a-table
bordered
:columns="columns"
:data-source="data"
:pagination="pagination">
<template #action = {record,index}>
.......//record 就表示表格里面某一行的的所有數據了
</template>
</a-table>
columns: [ { title: '姓名', dataIndex: 'name', key: 'name', }, { title: '年齡', dataIndex: 'age', key: 'age', }, { title: '住址', dataIndex: 'address', key: 'address',slots: {customRender:'action [自定義隨便起]'} }, ],
data: [
{
key: '1', //這里需要加上 key 值,不然后報錯 下面的data中 name 要與上面的dataIndex 相對應 若需要在表格中加上自定義的內容 則需要在
name: '胡彥斌',
age: 32,
address: '西湖區湖底公園1號',
},
{
key: '2',
name: '胡彥祖',
age: 42,
address: '西湖區湖底公園1號',
},
],