Blame view

examples/routers/table.vue 4.11 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
afea484f   梁灏   fixed #1271
2
3
4
5
6
7
8
      <Table
              width="550"
              border
              highlight-row
              :columns="columns2"
              @on-selection-change="change2"
              :data="data3"></Table>
2cb8a6d9   梁灏   commit Table comp...
9
10
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
11
      export default {
2cb8a6d9   梁灏   commit Table comp...
12
13
          data () {
              return {
8b530b1c   梁灏   fixed #1342
14
                  columns2: [
10d3a323   Aresn   fixed #1011
15
                      {
8b530b1c   梁灏   fixed #1342
16
17
18
                          type: 'selection',
                          width: 60,
                          align: 'center'
10d3a323   Aresn   fixed #1011
19
                      },
2404849c   leonine   合并原作者更新
20
                      {
8b530b1c   梁灏   fixed #1342
21
22
23
                          title: '姓名',
                          key: 'name',
                          width: 100,
096f2bfe   梁灏   fixed #1357
24
                          sortable: true,
1b737fdc   梁灏   fixed #122
25
26
27
28
  //                        fixed: 'left',
  //                        renderHeader: (h, params) => {
  //                            return h('Tag', params.index)
  //                        }
b89a982e   梁灏   fixed #205
29
30
                      },
                      {
8b530b1c   梁灏   fixed #1342
31
32
                          title: '年龄',
                          key: 'age',
1b737fdc   梁灏   fixed #122
33
                          sortable: true,
8b530b1c   梁灏   fixed #1342
34
                          width: 100
99d0429e   梁灏   update Button & T...
35
36
                      },
                      {
8b530b1c   梁灏   fixed #1342
37
38
39
40
41
42
43
44
45
46
47
48
49
                          title: '省份',
                          key: 'province',
                          width: 100
                      },
                      {
                          title: '市区',
                          key: 'city',
                          width: 100
                      },
                      {
                          title: '地址',
                          key: 'address',
                          width: 200
08fd628d   Aresn   Table support expand
50
51
                      },
                      {
8b530b1c   梁灏   fixed #1342
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
                          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'
                                      }
                                  }, '编辑')
                              ]);
                          }
                      }
                  ],
                  data3: [
                      {
7409cb3c   梁灏   fixed #549
81
82
                          name: '王小明',
                          age: 18,
4098c176   Aresn   update Table
83
                          address: '北京市朝阳区芍药居',
8b530b1c   梁灏   fixed #1342
84
85
86
                          province: '北京市',
                          city: '朝阳区',
                          zip: 100000
3c38e4f7   梁灏   update Table cell
87
                      },
891f61d8   梁灏   fixed #577
88
                      {
7409cb3c   梁灏   fixed #549
89
                          name: '张小刚',
8b530b1c   梁灏   fixed #1342
90
                          age: 25,
e4e8711d   Aresn   Table support dis...
91
                          address: '北京市海淀区西二旗',
8b530b1c   梁灏   fixed #1342
92
93
94
                          province: '北京市',
                          city: '海淀区',
                          zip: 100000
08fd628d   Aresn   Table support expand
95
96
97
98
                      },
                      {
                          name: '李小红',
                          age: 30,
d6070b23   Aresn   update Table
99
                          address: '上海市浦东新区世纪大道',
8b530b1c   梁灏   fixed #1342
100
101
102
                          province: '上海市',
                          city: '浦东新区',
                          zip: 100000
08fd628d   Aresn   Table support expand
103
104
105
106
                      },
                      {
                          name: '周小伟',
                          age: 26,
4098c176   Aresn   update Table
107
                          address: '深圳市南山区深南大道',
8b530b1c   梁灏   fixed #1342
108
109
110
                          province: '广东',
                          city: '南山区',
                          zip: 100000
68b308ee   梁灏   fixex #1353
111
                      }
8b530b1c   梁灏   fixed #1342
112
                  ]
2cb8a6d9   梁灏   commit Table comp...
113
              }
b0f1c61f   Rijn   add a event @on-s...
114
          },
8b530b1c   梁灏   fixed #1342
115
116
117
118
119
120
121
122
          methods: {
              change1 (d, l) {
  //                console.log(d)
  //                console.log(l)
              },
              change2 (d, l) {
                  console.log(d);
                  console.log(l);
b0f1c61f   Rijn   add a event @on-s...
123
              }
2cb8a6d9   梁灏   commit Table comp...
124
125
          }
      }
8b530b1c   梁灏   fixed #1342
126
  </script>