Blame view

examples/routers/table.vue 2.84 KB
2cb8a6d9   梁灏   commit Table comp...
1
  <template>
b0f1c61f   Rijn   add a event @on-s...
2
      <Table border :columns="columns5" :data="data5" @on-select="onSelect(true)" @on-select-cancel="onSelect(false)"></Table>
2cb8a6d9   梁灏   commit Table comp...
3
4
  </template>
  <script>
08fd628d   Aresn   Table support expand
5
      import etable from '../components/table.vue';
4098c176   Aresn   update Table
6
      import test from '../components/test.vue';
2cb8a6d9   梁灏   commit Table comp...
7
      export default {
2cb8a6d9   梁灏   commit Table comp...
8
9
          data () {
              return {
4098c176   Aresn   update Table
10
                  columns5: [
10d3a323   Aresn   fixed #1011
11
                      {
b0f1c61f   Rijn   add a event @on-s...
12
13
14
15
16
                          type: 'selection',
                          width: 60,
                          align: 'center'
                      },
                      {
08fd628d   Aresn   Table support expand
17
                          type: 'expand',
4098c176   Aresn   update Table
18
                          render: (h) => {
e40c5352   Aresn   fixed #1195
19
                              console.log('______hover______');
4098c176   Aresn   update Table
20
21
22
23
24
25
26
27
                              return h(etable);
                          },
                          width: 50
                      },
                      {
                          title: '日期',
                          key: 'date',
                          sortable: true
10d3a323   Aresn   fixed #1011
28
                      },
2404849c   leonine   合并原作者更新
29
                      {
7409cb3c   梁灏   fixed #549
30
                          title: '姓名',
4098c176   Aresn   update Table
31
                          key: 'name'
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
                      },
                      {
                          title: '操作',
4098c176   Aresn   update Table
44
                          key: 'name',
08fd628d   Aresn   Table support expand
45
                          render: (h, params) => {
4098c176   Aresn   update Table
46
47
48
49
50
                              return h(test, {
                                  props: {
                                      row: params.row
                                  }
                              });
08fd628d   Aresn   Table support expand
51
                          }
64f99c05   梁灏   Table support ren...
52
53
                      }
                  ],
4098c176   Aresn   update Table
54
                  data5: [
7409cb3c   梁灏   fixed #549
55
56
57
                      {
                          name: '王小明',
                          age: 18,
4098c176   Aresn   update Table
58
59
                          address: '北京市朝阳区芍药居',
                          date: '2016-10-03'
3c38e4f7   梁灏   update Table cell
60
                      },
891f61d8   梁灏   fixed #577
61
                      {
7409cb3c   梁灏   fixed #549
62
63
                          name: '张小刚',
                          age: 25,
e4e8711d   Aresn   Table support dis...
64
                          address: '北京市海淀区西二旗',
4098c176   Aresn   update Table
65
                          date: '2016-10-01'
08fd628d   Aresn   Table support expand
66
67
68
69
                      },
                      {
                          name: '李小红',
                          age: 30,
d6070b23   Aresn   update Table
70
                          address: '上海市浦东新区世纪大道',
4098c176   Aresn   update Table
71
                          date: '2016-10-02'
08fd628d   Aresn   Table support expand
72
73
74
75
                      },
                      {
                          name: '周小伟',
                          age: 26,
4098c176   Aresn   update Table
76
77
78
                          address: '深圳市南山区深南大道',
                          date: '2016-10-04'
                      },
d16dce64   梁灏   fixed #193
79
                  ]
2cb8a6d9   梁灏   commit Table comp...
80
              }
b0f1c61f   Rijn   add a event @on-s...
81
82
83
84
85
86
          },
  
          methods: {
              onSelect (value) {
                  window.alert(value);
              }
2cb8a6d9   梁灏   commit Table comp...
87
88
          }
      }
d0e206c5   梁灏   Table add content...
89
  </script>