内容就是这个的标题直接上代码
<template>
<a-table
:columns="columns"
:data-source="data"
:pagination="page"
:loading="loading"
size="default"
:rowKey="(record) => record.id"
@change="handleTableChange"
bordered
>
<span
slot="action"
slot-scope="text, record"
>
//操作列代码
</span>
</a-table>
</template>
<script>
export default {
data() {
return {
columns: [
{
title: '列表一',
width: 700,
dataIndex: 'train',
customRender: (text, row, index) => {
// row为这一行的数据拿到的row.train是我要展示的列表内容也就是一个list
const elements = row.train
const columnss = [
{
title: '子列表一',
width: 150,
dataIndex: 'train'
},
{
title: '子列表二',
dataIndex: 'doc',
width: 100,
},
{
title: '子列表三',
dataIndex: 'Link',
ellipsis: true,
// 通过条件显示是否为可点击的链接
customRender: (text, row, index) => {
if (text === '' || text === null) {
return row.LinkName
} else {
return (
<a-tooltip
title={row.Link}
placement="topLeft"
>
<a
href={text}
style="color: 'rgb(5 99 193)';text-decoration: underline;"
target="_blank"
>
{row.Link}
</a>
</a-tooltip>
)
}
}
}
]
return (
<a-table
dataSource={elements}
columns={columnss}
pagination={false}
size="small"
bordered
></a-table>
)
}
},]
}
}
</script>
其实ant design中也有嵌套子表单,虽然这个方法贼傻,但是他可操作性强啊,我还能固定首列之类的操作都不会影响,简直yyds