@@ -2,13 +2,56 @@ import * as React from 'react'
22import { Table } from 'element-react'
33import { Table as TableNext } from 'element-react/next'
44
5+ interface TestTableRow {
6+ date : string ;
7+ name : string ;
8+ address : string ;
9+ }
10+
11+ const testData : TestTableRow [ ] = [ {
12+ date : '2016-05-02' ,
13+ name : '王小虎' ,
14+ address : '上海市普陀区金沙江路 1518 弄'
15+ } , {
16+ date : '2016-05-04' ,
17+ name : '王小虎' ,
18+ address : '上海市普陀区金沙江路 1517 弄'
19+ } , {
20+ date : '2016-05-01' ,
21+ name : '王小虎' ,
22+ address : '上海市普陀区金沙江路 1519 弄'
23+ } , {
24+ date : '2016-05-03' ,
25+ name : '王小虎' ,
26+ address : '上海市普陀区金沙江路 1516 弄'
27+ } , {
28+ date : '2016-05-02' ,
29+ name : '王小虎' ,
30+ address : '上海市普陀区金沙江路 1518 弄'
31+ } , {
32+ date : '2016-05-04' ,
33+ name : '王小虎' ,
34+ address : '上海市普陀区金沙江路 1517 弄'
35+ } , {
36+ date : '2016-05-01' ,
37+ name : '王小虎' ,
38+ address : '上海市普陀区金沙江路 1519 弄'
39+ } , {
40+ date : '2016-05-03' ,
41+ name : '王小虎' ,
42+ address : '上海市普陀区金沙江路 1516 弄'
43+ } ]
44+
545class Component extends React . Component < { } , { } > {
646 state = {
747 columns : [
848 {
949 label : "日期" ,
1050 prop : "date" ,
11- width : 180
51+ width : 180 ,
52+ render : function ( data : TestTableRow , columns , index ) {
53+ return data . date ;
54+ }
1255 } ,
1356 {
1457 label : "姓名" ,
@@ -20,39 +63,7 @@ class Component extends React.Component<{}, {}> {
2063 prop : "address"
2164 }
2265 ] ,
23- data : [ {
24- date : '2016-05-02' ,
25- name : '王小虎' ,
26- address : '上海市普陀区金沙江路 1518 弄'
27- } , {
28- date : '2016-05-04' ,
29- name : '王小虎' ,
30- address : '上海市普陀区金沙江路 1517 弄'
31- } , {
32- date : '2016-05-01' ,
33- name : '王小虎' ,
34- address : '上海市普陀区金沙江路 1519 弄'
35- } , {
36- date : '2016-05-03' ,
37- name : '王小虎' ,
38- address : '上海市普陀区金沙江路 1516 弄'
39- } , {
40- date : '2016-05-02' ,
41- name : '王小虎' ,
42- address : '上海市普陀区金沙江路 1518 弄'
43- } , {
44- date : '2016-05-04' ,
45- name : '王小虎' ,
46- address : '上海市普陀区金沙江路 1517 弄'
47- } , {
48- date : '2016-05-01' ,
49- name : '王小虎' ,
50- address : '上海市普陀区金沙江路 1519 弄'
51- } , {
52- date : '2016-05-03' ,
53- name : '王小虎' ,
54- address : '上海市普陀区金沙江路 1516 弄'
55- } ]
66+ data : testData
5667 }
5768 render ( ) {
5869 const { columns, data } = this . state
0 commit comments