Blame view

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