Blame view

src/components/base/render.vue 778 Bytes
1f974700   Aresn   Tabs support rend...
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
  <template>
      <div ref="cell"></div>
  </template>
  <script>
      import Vue from 'vue';
      export default {
          name: 'RenderCell',
          props: {
              render: Function
          },
          methods: {
              compile () {
                  if (this.render) {
                      this.$el.innerHTML = '';
                      const component = new Vue({
                          functional: true,
                          render: (h) => {
                              return this.render(h);
                          }
                      });
                      const Cell = component.$mount();
                      this.$refs.cell.appendChild(Cell.$el);
                  }
              }
          },
          mounted () {
              this.compile();
          }
      };
  </script>