Blame view

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