Table add content prop to compile custom component

Table add content prop to compile custom component
This commit is contained in:
梁灏 2016-12-01 11:02:06 +08:00
parent 224a3ae539
commit d0e206c501
4 changed files with 57 additions and 34 deletions

View file

@ -27,7 +27,8 @@
data () {
return {
renderType: '',
uid: -1
uid: -1,
content: this.$parent.$parent.content
}
},
computed: {
@ -43,7 +44,7 @@
methods: {
compile () {
if (this.column.render) {
const $parent = this.$parent.$parent.$parent;
const $parent = this.content;
const template = this.column.render(this.row, this.column, this.index);
const cell = document.createElement('div');
cell.innerHTML = template;
@ -59,7 +60,7 @@
}
},
destroy () {
const $parent = this.$parent.$parent.$parent;
const $parent = this.content;
for (let i = 0; i < $parent.$children.length; i++) {
if ($parent.$children[i]._uid === this.uid) {
$parent.$children[i].$destroy();