Blame view

examples/routers/table.vue 4.67 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
bb49347b   梁灏   fixed #2823
2
      <div>
14d1de05   huanghong   fix table changin...
3
          <Table border ref="selection" :columns="columns4" :data="data1" :height='258'></Table>
bb49347b   梁灏   fixed #2823
4
5
6
7
          <Button @click="handleSetData">Set Data</Button>
          <Button @click="handleClearData">Clear Data</Button>
          <Button @click="handleSelectAll(true)">Set all selected</Button>
          <Button @click="handleSelectAll(false)">Cancel all selected</Button>
47638ad8   huanghong   fixed table scrol...
8
          
ebaf3c1d   huanghong   table test
9
          <div style='margin:20px 0px;'>
47638ad8   huanghong   fixed table scrol...
10
              <Table :data="tableData1" :columns="tableColumns1" :height='500' stripe size='small'></Table>
944c0dac   huanghong   add example for d...
11
12
13
14
15
16
              <div style="margin: 10px;overflow: hidden">
                  <div style="float: right;">
                      <Page :total="100" show-sizer :current="1" @on-change="changePage"></Page>
                  </div>
              </div>
          </div>
bb49347b   梁灏   fixed #2823
17
      </div>
2cb8a6d9   梁灏   commit Table comp...
18
19
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
20
      export default {
51356c2c   梁灏   fixed #658
21
22
          data () {
              return {
bb49347b   梁灏   fixed #2823
23
                  columns4: [
ceeb9361   梁灏   fixed Table bug i...
24
                      {
bb49347b   梁灏   fixed #2823
25
26
27
                          type: 'selection',
                          width: 60,
                          align: 'center'
ceeb9361   梁灏   fixed Table bug i...
28
                      },
437b8059   Sergio Crisostomo   Added Table to CS...
29
                      {
55f90d87   梁灏   fixed #1648
30
                          title: 'Name',
14d1de05   huanghong   fix table changin...
31
32
                          key: 'name',
                          width: 260
2993f4ee   梁灏   update Tab
33
34
                      },
                      {
55f90d87   梁灏   fixed #1648
35
                          title: 'Age',
bb49347b   梁灏   fixed #2823
36
                          key: 'age'
2993f4ee   梁灏   update Tab
37
38
                      },
                      {
55f90d87   梁灏   fixed #1648
39
                          title: 'Address',
14d1de05   huanghong   fix table changin...
40
41
42
43
44
45
46
                          key: 'address',
                          width: 260
                      },
                      {
                          title: 'Address',
                          key: 'address',
                          width: 260
437b8059   Sergio Crisostomo   Added Table to CS...
47
48
                      }
                  ],
bb49347b   梁灏   fixed #2823
49
50
                  data1: [
  
944c0dac   huanghong   add example for d...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
                  ],
                  
                  tableData1: [],
                  tableColumns1: [
                      {
                          title: 'Data1',
                          key: 'data1'
                      },
                      {
                          title: 'Data2',
                          key: 'data2'
                      },
                      {
                          title: 'Data3',
                          key: 'data3'
                      },
                      {
                          title: 'Data4',
                          key: 'data4'
                      },
                      {
                          title: 'Data5',
                          key: 'data5'
                      },
                      {
ebaf3c1d   huanghong   table test
76
                          title: 'Data6Data6Data6Data6Data6Data6Data6Data6Data6Data6Data6',
944c0dac   huanghong   add example for d...
77
78
                          key: 'data6'
                      },
bb49347b   梁灏   fixed #2823
79
80
81
                  ]
              }
          },
944c0dac   huanghong   add example for d...
82
83
84
          mounted(){
              this.refreshData();
          },
bb49347b   梁灏   fixed #2823
85
86
87
88
89
90
          methods: {
              handleSelectAll (status) {
                  this.$refs.selection.selectAll(status);
              },
              handleSetData () {
                  this.data1 = [
b142865e   梁灏   fixed #2102
91
92
93
94
                      {
                          name: 'John Brown',
                          age: 18,
                          address: 'New York No. 1 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
95
                          date: '2016-10-03'
b142865e   梁灏   fixed #2102
96
97
98
99
                      },
                      {
                          name: 'Jim Green',
                          age: 24,
ceeb9361   梁灏   fixed Table bug i...
100
101
                          address: 'London No. 1 Lake Park',
                          date: '2016-10-01'
b142865e   梁灏   fixed #2102
102
103
104
105
106
                      },
                      {
                          name: 'Joe Black',
                          age: 30,
                          address: 'Sydney No. 1 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
107
                          date: '2016-10-02'
b142865e   梁灏   fixed #2102
108
109
110
111
112
                      },
                      {
                          name: 'Jon Snow',
                          age: 26,
                          address: 'Ottawa No. 2 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
113
                          date: '2016-10-04'
437b8059   Sergio Crisostomo   Added Table to CS...
114
                      }
bb49347b   梁灏   fixed #2823
115
116
117
118
                  ];
              },
              handleClearData () {
                  this.data1 = [];
944c0dac   huanghong   add example for d...
119
120
121
122
123
124
125
126
127
128
              },
              refreshData(){
                  let data = [];
                  for (let i = 0; i < 10; i++) {
                      data.push({
                          data1: Math.floor(Math.random () * 10000),
                          data2: Math.floor(Math.random () * 1000000),
                          data3: Math.floor(Math.random () * 100000000),
                          data4: Math.floor(Math.random () * Math.random () * 10000),
                          data5: Math.floor(Math.random () * Math.random () * 1000000),
47638ad8   huanghong   fixed table scrol...
129
                          data6: ''+Math.floor(Math.random () * Math.random () * 100000000)+Math.floor(Math.random () * 100000000)+Math.floor(Math.random () * 100000000),
944c0dac   huanghong   add example for d...
130
131
132
133
134
135
                      });
                  }
                  this.tableData1 = data;
              },
              changePage(){
                  this.refreshData();
c5beedf8   梁灏   fixed #690
136
              }
2cb8a6d9   梁灏   commit Table comp...
137
          }
6c634aa6   梁灏   fixed #2078
138
      }
17db7df4   梁灏   fixed #1751
139
  </script>