Antd给表格一个斜线分隔(通过css改变)

“position”: “relative”

}}>

“content”: “”,

“position”: “absolute”,

“width”: “1px”,

“height”: “140px”,

“top”: “-48px”,

“left”: “42px”,

“backgroundColor”: “#1A3A50”,

“display”: “block”,

“transform”: “rotate(-57deg)”

}}>

,

dataIndex: “indexName”,

key: “indexName”,

width: “9%”

])

`

发一个完整的案例:

在这里插入图片描述

vue项目代码:

中共温州银行金融科技部一支部委员会党费公示

公示时间:{ { detailInfo.pubStartdate }}至{ {detailInfo.pubEnddate}}

<a-table

bordered

:data-source=“dataSource”<

  • 14
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用antd中的Table组件和ExpandableRow属性来实现表格嵌套表格的效果。 首先,需要定义一个父表格和一个子表格的columns和dataSource,然后在父表格中设置ExpandableRow属性来渲染子表格。 以下是示例代码: ```javascript import React, { useState } from 'react'; import { Table } from 'antd'; const ParentTable = () => { // 定义父表格数据 const [data, setData] = useState([ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park', children: [ { key: '11', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', }, { key: '12', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park', }, ], }, { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', children: [ { key: '21', name: 'Jim Green', age: 42, address: 'London No. 2 Lake Park', }, { key: '22', name: 'Joe Black', age: 32, address: 'Sidney No. 2 Lake Park', }, ], }, ]); // 定义父表格列 const columns = [ { title: 'Name', dataIndex: 'name', key: 'name', }, { title: 'Age', dataIndex: 'age', key: 'age', }, { title: 'Address', dataIndex: 'address', key: 'address', }, ]; // 定义子表格列 const subColumns = [ { title: 'Name', dataIndex: 'name', key: 'name', }, { title: 'Age', dataIndex: 'age', key: 'age', }, { title: 'Address', dataIndex: 'address', key: 'address', }, ]; // 定义展开行方法 const expandable = { expandedRowRender: (record) => { return ( <Table columns={subColumns} dataSource={record.children} pagination={false} /> ); }, rowExpandable: (record) => record.children.length > 0, }; return ( <Table columns={columns} dataSource={data} expandable={expandable} pagination={false} /> ); }; export default ParentTable; ``` 在以上示例代码中,我们首先定义了父表格的columns和dataSource,以及子表格的columns。然后定义了一个expandable对象,其中定义了展开行的渲染方法和展开条件。最后,在父表格中使用expandable属性来渲染子表格。 注意,为了使子表格的列与父表格的列对齐,需要在子表格的列中定义key值,并且保证与父表格列的key值一致。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值