Table prop: content modify to context

Table prop: content modify to context
This commit is contained in:
梁灏 2017-03-17 09:50:11 +08:00
parent 02ece5df26
commit d8892603f7
2 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@
return { return {
renderType: '', renderType: '',
uid: -1, uid: -1,
content: this.$parent.$parent.currentContent context: this.$parent.$parent.currentContext
}; };
}, },
computed: { computed: {
@ -48,7 +48,7 @@
methods: { methods: {
compile () { compile () {
if (this.column.render) { if (this.column.render) {
const $parent = this.content; const $parent = this.context;
const template = this.column.render(this.row, this.column, this.index); const template = this.column.render(this.row, this.column, this.index);
const cell = document.createElement('div'); const cell = document.createElement('div');
cell.innerHTML = template; cell.innerHTML = template;

View file

@ -142,7 +142,7 @@
return ''; return '';
} }
}, },
content: { context: {
type: Object type: Object
}, },
noDataText: { noDataText: {
@ -173,7 +173,7 @@
bodyHeight: 0, bodyHeight: 0,
bodyRealHeight: 0, bodyRealHeight: 0,
scrollBarWidth: getScrollBarSize(), scrollBarWidth: getScrollBarSize(),
currentContent: this.content, currentContext: this.context,
cloneData: deepCopy(this.data) // when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data cloneData: deepCopy(this.data) // when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data
}; };
}, },
@ -644,7 +644,7 @@
} }
}, },
created () { created () {
if (!this.content) this.currentContent = this.$parent; if (!this.context) this.currentContext = this.$parent;
this.showSlotHeader = this.$refs.title !== undefined; this.showSlotHeader = this.$refs.title !== undefined;
this.showSlotFooter = this.$refs.footer !== undefined; this.showSlotFooter = this.$refs.footer !== undefined;
this.rebuildData = this.makeDataWithSortAndFilter(); this.rebuildData = this.makeDataWithSortAndFilter();