|
| 1 | +--- |
| 2 | +order: 1 |
| 3 | +title: CTable |
| 4 | +desc: 默认表格 |
| 5 | +--- |
| 6 | + |
| 7 | +```jsx |
| 8 | +import React from 'react'; |
| 9 | +import { CTable } from 'cloud-react'; |
| 10 | + |
| 11 | +const data = [ |
| 12 | + { number: '1234455', name: '手机号优先继续发送1', createTime: '2021/12/14 10:19:02', creator: 'liyuan.meng', num: '12,222' }, |
| 13 | + { number: 122, name: 'ouid疲劳度3', createTime: '2021/12/13 15:47:33 ', creator: 'jiaojiao.diao', num: '198' }, |
| 14 | + { number: 12243, name: '继续发送手机1', createTime: '2021/12/13 15:36:42', creator: 'nan.run', num: '1,232' }, |
| 15 | + { number: 2345, name: '继续发送手机2', createTime: '2021/12/13 11:14:40', creator: 'xiaotong.fan', num: '12,122,112' }, |
| 16 | + { number: 1231322, name: '继续发送手机3', createTime: '2021/12/13 11:03:05', creator: 'zhenxiao.guo', num: '1000,000' }, |
| 17 | +]; |
| 18 | + |
| 19 | +const columns = [ |
| 20 | + { |
| 21 | + title: '年月日时分秒', |
| 22 | + dataIndex: 'createTime', |
| 23 | + width: 190, |
| 24 | + type: 'TIME', |
| 25 | + }, |
| 26 | + { |
| 27 | + title: '年月日', |
| 28 | + dataIndex: 'createTime', |
| 29 | + width: 130, |
| 30 | + type: 'TIME', |
| 31 | + typeConfig: { |
| 32 | + format: 'YYYY-MM-DD', |
| 33 | + } |
| 34 | + }, |
| 35 | + { |
| 36 | + title: '年月', |
| 37 | + dataIndex: 'createTime', |
| 38 | + width: 90, |
| 39 | + type: 'TIME', |
| 40 | + typeConfig: { |
| 41 | + format: 'YYYY-MM', |
| 42 | + } |
| 43 | + }, |
| 44 | + { |
| 45 | + title: '月日', |
| 46 | + dataIndex: 'createTime', |
| 47 | + width: 90, |
| 48 | + type: 'TIME', |
| 49 | + typeConfig: { |
| 50 | + format: 'MM-DD', |
| 51 | + } |
| 52 | + }, |
| 53 | + { |
| 54 | + title: '时分秒', |
| 55 | + dataIndex: 'createTime', |
| 56 | + width: 100, |
| 57 | + type: 'TIME', |
| 58 | + typeConfig: { |
| 59 | + format: 'HH:MM:SS', |
| 60 | + } |
| 61 | + }, |
| 62 | +]; |
| 63 | + |
| 64 | +export default function CTableDemo() { |
| 65 | + return ( |
| 66 | + <CTable |
| 67 | + style={{ height: 400 }} |
| 68 | + columnData={columns} |
| 69 | + ajaxData={{ totals: data.length, data }} |
| 70 | + /> |
| 71 | + ); |
| 72 | +} |
| 73 | +``` |
0 commit comments