Blame view

examples/routers/table.vue 3.65 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
3aca3d56   梁灏   fixed #1372
2
      <div>
300bd662   梁灏   fixed #704
3
4
5
6
7
8
9
          <Table width="550" height="200" highlight-row :loading="loading" :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc">
              <div slot="loading">
                  <Icon type="load-c" size=18 class="demo-spin-icon-load"></Icon>
                  <div>Loading</div>
              </div>
          </Table>
          <br><br>
3aca3d56   梁灏   fixed #1372
10
          <Button @click="handleClear">clear</Button>
300bd662   梁灏   fixed #704
11
          <Button @click="loading = !loading">Loading</Button>
3aca3d56   梁灏   fixed #1372
12
      </div>
2cb8a6d9   梁灏   commit Table comp...
13
14
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
15
      export default {
51356c2c   梁灏   fixed #658
16
17
          data () {
              return {
300bd662   梁灏   fixed #704
18
                  loading: false,
3aca3d56   梁灏   fixed #1372
19
                  columns3: [
10d3a323   Aresn   fixed #1011
20
                      {
8a392d25   梁灏   Table expand supp...
21
                          title: '姓名',
300bd662   梁灏   fixed #704
22
23
24
                          key: 'name',
                          width: 100,
                          fixed: 'left'
51356c2c   梁灏   fixed #658
25
26
                      },
                      {
8a392d25   梁灏   Table expand supp...
27
                          title: '年龄',
ade5dbba   梁灏   fixed #693
28
                          key: 'age',
300bd662   梁灏   fixed #704
29
30
31
32
33
34
35
36
37
38
39
                          width: 100
                      },
                      {
                          title: '省份',
                          key: 'province',
                          width: 100
                      },
                      {
                          title: '市区',
                          key: 'city',
                          width: 100
51356c2c   梁灏   fixed #658
40
                      },
8a392d25   梁灏   Table expand supp...
41
42
                      {
                          title: '地址',
300bd662   梁灏   fixed #704
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
                          key: 'address',
                          width: 200
                      },
                      {
                          title: '邮编',
                          key: 'zip',
                          width: 100
                      },
                      {
                          title: '操作',
                          key: 'action',
                          fixed: 'right',
                          width: 120,
                          render: (h, params) => {
                              return h('div', [
                                  h('Button', {
                                      props: {
                                          type: 'text',
                                          size: 'small'
                                      }
                                  }, '查看'),
                                  h('Button', {
                                      props: {
                                          type: 'text',
                                          size: 'small'
                                      }
                                  }, '编辑')
                              ]);
                          }
8a392d25   梁灏   Table expand supp...
72
                      }
51356c2c   梁灏   fixed #658
73
                  ],
17db7df4   梁灏   fixed #1751
74
                  data1: [
835b37ff   梁灏   fixed #1403
75
76
77
                      {
                          name: '王小明',
                          age: 18,
3aca3d56   梁灏   fixed #1372
78
                          address: '北京市朝阳区芍药居'
835b37ff   梁灏   fixed #1403
79
80
81
82
                      },
                      {
                          name: '张小刚',
                          age: 25,
3aca3d56   梁灏   fixed #1372
83
                          address: '北京市海淀区西二旗'
835b37ff   梁灏   fixed #1403
84
                      },
8a392d25   梁灏   Table expand supp...
85
86
87
                      {
                          name: '李小红',
                          age: 30,
3aca3d56   梁灏   fixed #1372
88
                          address: '上海市浦东新区世纪大道'
8a392d25   梁灏   Table expand supp...
89
90
91
92
                      },
                      {
                          name: '周小伟',
                          age: 26,
3aca3d56   梁灏   fixed #1372
93
                          address: '深圳市南山区深南大道'
8a392d25   梁灏   Table expand supp...
94
                      }
8b530b1c   梁灏   fixed #1342
95
                  ]
2cb8a6d9   梁灏   commit Table comp...
96
              }
3aca3d56   梁灏   fixed #1372
97
98
99
100
101
102
          },
          methods: {
              handleClear () {
                  this.$refs.table.clearCurrentRow();
              },
              handleChange (newData, oldData) {
ade5dbba   梁灏   fixed #693
103
104
105
106
  //                console.log(newData, oldData)
              },
              rc (data, index) {
                  console.log(data, index);
3aca3d56   梁灏   fixed #1372
107
              }
2cb8a6d9   梁灏   commit Table comp...
108
109
          }
      }
17db7df4   梁灏   fixed #1751
110
  </script>