Blame view

examples/routers/table.vue 4.42 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
2474ee59   Lawrence Lee   add hover-highlig...
2
      <div>
9563a8da   Lawrence Lee   add disable-highl...
3
          <Table border :columns="columns7" :data="data6" disable-highlight></Table>
2474ee59   Lawrence Lee   add hover-highlig...
4
      </div>
2cb8a6d9   梁灏   commit Table comp...
5
6
  </template>
  <script>
08fd628d   Aresn   Table support expand
7
      import etable from '../components/table.vue';
2cb8a6d9   梁灏   commit Table comp...
8
      export default {
08fd628d   Aresn   Table support expand
9
          components: { etable },
2cb8a6d9   梁灏   commit Table comp...
10
11
          data () {
              return {
08fd628d   Aresn   Table support expand
12
                  columns7: [
2474ee59   Lawrence Lee   add hover-highlig...
13
14
15
16
17
18
19
20
  //                     {
  //                         type: 'expand',
  //                         width: 50,
  //                         render: (h, params) => {
  // //                            return h(etable);
  //                             return h('div', params.row.name)
  //                         }
  //                     },
2404849c   leonine   合并原作者更新
21
                      {
7409cb3c   梁灏   fixed #549
22
                          title: '姓名',
64f99c05   梁灏   Table support ren...
23
                          key: 'name',
2474ee59   Lawrence Lee   add hover-highlig...
24
                          fixed: 'left',
10d3a323   Aresn   fixed #1011
25
                          render: (h, params) => {
08fd628d   Aresn   Table support expand
26
27
28
29
30
31
32
33
                              return h('div', [
                                  h('Icon', {
                                      props: {
                                          type: 'person'
                                      }
                                  }),
                                  h('strong', params.row.name)
                              ]);
64f99c05   梁灏   Table support ren...
34
                          }
b89a982e   梁灏   fixed #205
35
36
                      },
                      {
7409cb3c   梁灏   fixed #549
37
                          title: '年龄',
10d3a323   Aresn   fixed #1011
38
39
                          key: 'age',
                          sortable: true
99d0429e   梁灏   update Button & T...
40
41
                      },
                      {
7409cb3c   梁灏   fixed #549
42
43
                          title: '地址',
                          key: 'address'
08fd628d   Aresn   Table support expand
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
72
73
74
75
76
77
78
                      },
                      {
                          title: '操作',
                          key: 'action',
                          width: 150,
                          align: 'center',
                          render: (h, params) => {
                              return h('div', [
                                  h('Button', {
                                      props: {
                                          type: 'primary',
                                          size: 'small'
                                      },
                                      style: {
                                          marginRight: '5px'
                                      },
                                      on: {
                                          click: () => {
                                              this.show(params.index)
                                          }
                                      }
                                  }, '查看'),
                                  h('Button', {
                                      props: {
                                          type: 'error',
                                          size: 'small'
                                      },
                                      on: {
                                          click: () => {
                                              this.remove(params.index)
                                          }
                                      }
                                  }, '删除')
                              ]);
                          }
64f99c05   梁灏   Table support ren...
79
80
                      }
                  ],
08fd628d   Aresn   Table support expand
81
                  data6: [
7409cb3c   梁灏   fixed #549
82
83
84
                      {
                          name: '王小明',
                          age: 18,
08fd628d   Aresn   Table support expand
85
                          address: '北京市朝阳区芍药居'
3c38e4f7   梁灏   update Table cell
86
                      },
891f61d8   梁灏   fixed #577
87
                      {
7409cb3c   梁灏   fixed #549
88
89
                          name: '张小刚',
                          age: 25,
e4e8711d   Aresn   Table support dis...
90
91
                          address: '北京市海淀区西二旗',
                          _disableExpand: true
08fd628d   Aresn   Table support expand
92
93
94
95
                      },
                      {
                          name: '李小红',
                          age: 30,
d6070b23   Aresn   update Table
96
97
                          address: '上海市浦东新区世纪大道',
                          _expanded: true
08fd628d   Aresn   Table support expand
98
99
100
101
102
                      },
                      {
                          name: '周小伟',
                          age: 26,
                          address: '深圳市南山区深南大道'
891f61d8   梁灏   fixed #577
103
                      }
d16dce64   梁灏   fixed #193
104
                  ]
2cb8a6d9   梁灏   commit Table comp...
105
              }
08fd628d   Aresn   Table support expand
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
          },
          methods: {
              show (index) {
                  this.$Modal.info({
                      title: '用户信息',
                      content: `姓名:${this.data6[index].name}<br>年龄:${this.data6[index].age}<br>地址:${this.data6[index].address}`
                  })
              },
              remove (index) {
                  this.data6.splice(index, 1);
              },
              expand (row, s) {
  //                console.log(row);
  //                console.log(s);
              }
2cb8a6d9   梁灏   commit Table comp...
121
122
          }
      }
d0e206c5   梁灏   Table add content...
123
  </script>