DataTableStruct.jsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import React from "react";
  2. import { Table } from "antd";
  3. import styled from 'styled-components'
  4. const DataTable = styled.div`
  5. .table-style {
  6. .ant-table-thead {
  7. > tr {
  8. > th {
  9. background: #e3eefd !important;
  10. }
  11. }
  12. }
  13. }
  14. `
  15. export default function DataTableStruct() {
  16. const columns = [
  17. {
  18. title: '序号',
  19. dataIndex: 'id',
  20. key: 'id',
  21. },
  22. {
  23. title: '字段',
  24. dataIndex: 'field',
  25. key: 'field',
  26. },
  27. {
  28. title: '类型',
  29. dataIndex: 'type',
  30. key: 'type',
  31. },
  32. {
  33. title: '长度',
  34. dataIndex: 'length',
  35. key: 'length',
  36. },
  37. ]
  38. const data = [
  39. {
  40. key: 1,
  41. id: 1,
  42. field: 'SCHED_NAME',
  43. type: 'VARCHAR(120)',
  44. length: 120
  45. },
  46. {
  47. key: 2,
  48. id: 2,
  49. field: 'SCHED_NAME',
  50. type: 'VARCHAR(120)',
  51. length: 120
  52. },
  53. {
  54. key: 3,
  55. id: 3,
  56. field: 'SCHED_NAME',
  57. type: 'VARCHAR(120)',
  58. length: 120
  59. },
  60. ]
  61. return (
  62. <DataTable>
  63. <Table columns={columns} dataSource={data} className={'table-style'} />
  64. </DataTable>
  65. )
  66. }