Blame view

examples/routers/table.vue 3.89 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
24
                          title: '姓名',
                          key: 'name',
                          width: 100,
                          fixed: 'left'
b89a982e   梁灏   fixed #205
25
26
                      },
                      {
8b530b1c   梁灏   fixed #1342
27
28
29
                          title: '年龄',
                          key: 'age',
                          width: 100
99d0429e   梁灏   update Button & T...
30
31
                      },
                      {
8b530b1c   梁灏   fixed #1342
32
33
34
35
36
37
38
39
40
41
42
43
44
                          title: '省份',
                          key: 'province',
                          width: 100
                      },
                      {
                          title: '市区',
                          key: 'city',
                          width: 100
                      },
                      {
                          title: '地址',
                          key: 'address',
                          width: 200
08fd628d   Aresn   Table support expand
45
46
                      },
                      {
8b530b1c   梁灏   fixed #1342
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
72
73
74
75
                          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
76
77
                          name: '王小明',
                          age: 18,
4098c176   Aresn   update Table
78
                          address: '北京市朝阳区芍药居',
8b530b1c   梁灏   fixed #1342
79
80
81
                          province: '北京市',
                          city: '朝阳区',
                          zip: 100000
3c38e4f7   梁灏   update Table cell
82
                      },
891f61d8   梁灏   fixed #577
83
                      {
7409cb3c   梁灏   fixed #549
84
                          name: '张小刚',
8b530b1c   梁灏   fixed #1342
85
                          age: 25,
e4e8711d   Aresn   Table support dis...
86
                          address: '北京市海淀区西二旗',
8b530b1c   梁灏   fixed #1342
87
88
89
                          province: '北京市',
                          city: '海淀区',
                          zip: 100000
08fd628d   Aresn   Table support expand
90
91
92
93
                      },
                      {
                          name: '李小红',
                          age: 30,
d6070b23   Aresn   update Table
94
                          address: '上海市浦东新区世纪大道',
8b530b1c   梁灏   fixed #1342
95
96
97
                          province: '上海市',
                          city: '浦东新区',
                          zip: 100000
08fd628d   Aresn   Table support expand
98
99
100
101
                      },
                      {
                          name: '周小伟',
                          age: 26,
4098c176   Aresn   update Table
102
                          address: '深圳市南山区深南大道',
8b530b1c   梁灏   fixed #1342
103
104
105
                          province: '广东',
                          city: '南山区',
                          zip: 100000
68b308ee   梁灏   fixex #1353
106
                      }
8b530b1c   梁灏   fixed #1342
107
                  ]
2cb8a6d9   梁灏   commit Table comp...
108
              }
b0f1c61f   Rijn   add a event @on-s...
109
          },
8b530b1c   梁灏   fixed #1342
110
111
112
113
114
115
116
117
          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...
118
              }
2cb8a6d9   梁灏   commit Table comp...
119
120
          }
      }
8b530b1c   梁灏   fixed #1342
121
  </script>