Blame view

examples/routers/table.vue 2.02 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
3aca3d56   梁灏   fixed #1372
2
      <div>
ade5dbba   梁灏   fixed #693
3
          <Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc"></Table>
3aca3d56   梁灏   fixed #1372
4
5
          <Button @click="handleClear">clear</Button>
      </div>
2cb8a6d9   梁灏   commit Table comp...
6
7
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
8
      export default {
51356c2c   梁灏   fixed #658
9
10
          data () {
              return {
3aca3d56   梁灏   fixed #1372
11
                  columns3: [
10d3a323   Aresn   fixed #1011
12
                      {
3aca3d56   梁灏   fixed #1372
13
                          type: 'index',
17db7df4   梁灏   fixed #1751
14
15
                          width: 60,
                          align: 'center'
51356c2c   梁灏   fixed #658
16
17
                      },
                      {
8a392d25   梁灏   Table expand supp...
18
19
                          title: '姓名',
                          key: 'name'
51356c2c   梁灏   fixed #658
20
21
                      },
                      {
8a392d25   梁灏   Table expand supp...
22
                          title: '年龄',
ade5dbba   梁灏   fixed #693
23
24
                          key: 'age',
                          sortable: true
51356c2c   梁灏   fixed #658
25
                      },
8a392d25   梁灏   Table expand supp...
26
27
28
29
                      {
                          title: '地址',
                          key: 'address'
                      }
51356c2c   梁灏   fixed #658
30
                  ],
17db7df4   梁灏   fixed #1751
31
                  data1: [
835b37ff   梁灏   fixed #1403
32
33
34
                      {
                          name: '王小明',
                          age: 18,
3aca3d56   梁灏   fixed #1372
35
                          address: '北京市朝阳区芍药居'
835b37ff   梁灏   fixed #1403
36
37
38
39
                      },
                      {
                          name: '张小刚',
                          age: 25,
3aca3d56   梁灏   fixed #1372
40
                          address: '北京市海淀区西二旗'
835b37ff   梁灏   fixed #1403
41
                      },
8a392d25   梁灏   Table expand supp...
42
43
44
                      {
                          name: '李小红',
                          age: 30,
3aca3d56   梁灏   fixed #1372
45
                          address: '上海市浦东新区世纪大道'
8a392d25   梁灏   Table expand supp...
46
47
48
49
                      },
                      {
                          name: '周小伟',
                          age: 26,
3aca3d56   梁灏   fixed #1372
50
                          address: '深圳市南山区深南大道'
8a392d25   梁灏   Table expand supp...
51
                      }
8b530b1c   梁灏   fixed #1342
52
                  ]
2cb8a6d9   梁灏   commit Table comp...
53
              }
3aca3d56   梁灏   fixed #1372
54
55
56
57
58
59
          },
          methods: {
              handleClear () {
                  this.$refs.table.clearCurrentRow();
              },
              handleChange (newData, oldData) {
ade5dbba   梁灏   fixed #693
60
61
62
63
  //                console.log(newData, oldData)
              },
              rc (data, index) {
                  console.log(data, index);
3aca3d56   梁灏   fixed #1372
64
              }
2cb8a6d9   梁灏   commit Table comp...
65
66
          }
      }
17db7df4   梁灏   fixed #1751
67
  </script>