Blame view

examples/routers/table.vue 2.39 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
bb49347b   梁灏   fixed #2823
2
      <div>
7e8e6ef8   forfire   add dragdrop for tr
3
          <Table border ref="selection" :columns="columns4" :data="data1" @drag="true" @on-drag-drop="onDragDrop"></Table>
bb49347b   梁灏   fixed #2823
4
5
6
7
8
          <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>
      </div>
2cb8a6d9   梁灏   commit Table comp...
9
10
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
11
      export default {
51356c2c   梁灏   fixed #658
12
13
          data () {
              return {
bb49347b   梁灏   fixed #2823
14
                  columns4: [
ceeb9361   梁灏   fixed Table bug i...
15
                      {
bb49347b   梁灏   fixed #2823
16
17
18
                          type: 'selection',
                          width: 60,
                          align: 'center'
ceeb9361   梁灏   fixed Table bug i...
19
                      },
437b8059   Sergio Crisostomo   Added Table to CS...
20
                      {
55f90d87   梁灏   fixed #1648
21
                          title: 'Name',
ceeb9361   梁灏   fixed Table bug i...
22
                          key: 'name'
2993f4ee   梁灏   update Tab
23
24
                      },
                      {
55f90d87   梁灏   fixed #1648
25
                          title: 'Age',
bb49347b   梁灏   fixed #2823
26
                          key: 'age'
2993f4ee   梁灏   update Tab
27
28
                      },
                      {
55f90d87   梁灏   fixed #1648
29
                          title: 'Address',
b34e09b8   梁灏   fixed #2832
30
                          key: 'address'
437b8059   Sergio Crisostomo   Added Table to CS...
31
32
                      }
                  ],
bb49347b   梁灏   fixed #2823
33
34
35
36
37
38
39
40
41
42
43
                  data1: [
  
                  ]
              }
          },
          methods: {
              handleSelectAll (status) {
                  this.$refs.selection.selectAll(status);
              },
              handleSetData () {
                  this.data1 = [
b142865e   梁灏   fixed #2102
44
45
46
47
                      {
                          name: 'John Brown',
                          age: 18,
                          address: 'New York No. 1 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
48
                          date: '2016-10-03'
b142865e   梁灏   fixed #2102
49
50
51
52
                      },
                      {
                          name: 'Jim Green',
                          age: 24,
ceeb9361   梁灏   fixed Table bug i...
53
54
                          address: 'London No. 1 Lake Park',
                          date: '2016-10-01'
b142865e   梁灏   fixed #2102
55
56
57
58
59
                      },
                      {
                          name: 'Joe Black',
                          age: 30,
                          address: 'Sydney No. 1 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
60
                          date: '2016-10-02'
b142865e   梁灏   fixed #2102
61
62
63
64
65
                      },
                      {
                          name: 'Jon Snow',
                          age: 26,
                          address: 'Ottawa No. 2 Lake Park',
ceeb9361   梁灏   fixed Table bug i...
66
                          date: '2016-10-04'
437b8059   Sergio Crisostomo   Added Table to CS...
67
                      }
bb49347b   梁灏   fixed #2823
68
69
70
71
                  ];
              },
              handleClearData () {
                  this.data1 = [];
7e8e6ef8   forfire   add dragdrop for tr
72
73
74
              },
              onDragDrop(a,b){
                  console.log(a,b)
c5beedf8   梁灏   fixed #690
75
              }
2cb8a6d9   梁灏   commit Table comp...
76
          }
6c634aa6   梁灏   fixed #2078
77
      }
17db7df4   梁灏   fixed #1751
78
  </script>