Antd - 如何为表格行添加圆角边框?
创始人
2024-11-07 08:00:25
0

要为Antd的表格行添加圆角边框,可以使用CSS的伪元素来完成。下面是一个示例代码,演示了如何为表格行添加圆角边框:

import React from 'react';
import { Table } from 'antd';
import './styles.css';

const data = [
  {
    key: '1',
    name: 'John Doe',
    age: 25,
    address: 'New York',
  },
  {
    key: '2',
    name: 'Jane Smith',
    age: 30,
    address: 'London',
  },
  // ...
];

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
  // ...
];

const RoundedTable = () => {
  return (
    
  );
};

export default RoundedTable;

然后,在styles.css文件中添加以下样式:

.rounded-table .ant-table-tbody > tr > td {
  border-radius: 10px;
}

.rounded-table .ant-table-thead > tr > th:first-child,
.rounded-table .ant-table-tbody > tr > td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.rounded-table .ant-table-thead > tr > th:last-child,
.rounded-table .ant-table-tbody > tr > td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

在上面的代码中,我们使用了.rounded-table类来指定表格的样式。通过设置border-radius属性,我们可以为表格行添加圆角边框。为了使表格的第一列和最后一列的边框也具有圆角,我们使用了:first-child:last-child伪元素选择器来设置不同的圆角边框样式。

最后,将RoundedTable组件添加到你的应用程序中,你将看到表格行具有圆角边框的效果。

相关内容

热门资讯

了解透视!wepoker买脚本... 了解透视!wepoker买脚本靠谱吗,微信小程序微乐辅助器,秘籍教程(有人有挂)-哔哩哔哩1、首先打...
辅助透视!wepoker破解器... 辅助透视!wepoker破解器有用吗,微乐家乡脚本助手,绝活教程(真实有挂)-哔哩哔哩1、用户打开应...
必备透视!impoker辅助,... 必备透视!impoker辅助,微乐兰州麻将小程序辅助,积累教程(有挂教学)-哔哩哔哩1、起透看视 i...
揭幕透视!wepoker私人局... 揭幕透视!wepoker私人局辅助挂,微乐手游脚本辅助,操作教程(有挂教学)-哔哩哔哩1、游戏颠覆性...
解迷透视!智星德州可以透视吗,... 解迷透视!智星德州可以透视吗,微乐建房辅助工具免费入口,手册教程(有挂猫腻)-哔哩哔哩1、实时智星德...
详细透视!hhpoker智能辅... 详细透视!hhpoker智能辅助插件,苹果手机微信小程序游戏破解器,攻略教程(有挂技巧)-哔哩哔哩h...
总结透视!hhpoker辅助挂... 总结透视!hhpoker辅助挂是真的吗,微乐卡五星祈福有用吗,阶段教程(有挂解密)-哔哩哔哩1、hh...
揭露透视!wepoker手机版... 揭露透视!wepoker手机版透视脚本,微乐家乡小程序脚本ios,教材教程(有挂功能)-哔哩哔哩1、...
解迷透视!红龙poker辅助平... 解迷透视!红龙poker辅助平台,微乐广西小程序插件,模块教程(有挂规律)-哔哩哔哩小薇(辅助器软件...
详细透视!WePoKer辅助器... 详细透视!WePoKer辅助器,微乐智能插件激活码,要领教程(存在有挂)-哔哩哔哩详细透视!WePo...