Blame view

src/components/table/expand.vue 1017 Bytes
08fd628d   Aresn   Table support expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  <template>
      <div ref="cell"></div>
  </template>
  <script>
      import Vue from 'vue';
      export default {
          name: 'TableExpand',
          props: {
              row: Object,
              render: Function,
              index: Number,
          },
          methods: {
              compile () {
                  if (this.render) {
                      this.$el.innerHTML = '';
                      const component = new Vue({
                          functional: true,
                          render: (h) => {
                              return this.render(h, {
                                  row: this.row,
                                  index: this.index
                              });
                          }
                      });
                      const Cell = component.$mount();
                      this.$refs.cell.appendChild(Cell.$el);
                  }
              }
          },
          mounted () {
              this.$nextTick(() => {
                  this.compile();
              });
          }
      };
  </script>