This commit is contained in:
刘荣 2017-06-08 08:53:00 +08:00
parent b8adf5cf2d
commit 718e773fbc
5 changed files with 33 additions and 39 deletions

View file

@ -0,0 +1,13 @@
export default {
name: 'TableExpand',
functional: true,
props: {
row: Object,
render: Function,
index: Number,
},
render: (h, ctx) => {
return ctx.props.render(h, {row: ctx.props.row, index: ctx.props.index});
}
};

View file

@ -1,37 +0,0 @@
<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>

View file

@ -38,7 +38,7 @@
<script>
// todo :key="row"
import Cell from './cell.vue';
import Expand from './expand.vue';
import Expand from './expand.js';
import Mixin from './mixin';
export default {