Blame view

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