Commit d8892603f7b4e52259c9eece3252969b17889398

Authored by 梁灏
1 parent 02ece5df

Table prop: content modify to context

Table prop: content modify to context
src/components/table/cell.vue
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 return { 31 return {
32 renderType: '', 32 renderType: '',
33 uid: -1, 33 uid: -1,
34 - content: this.$parent.$parent.currentContent 34 + context: this.$parent.$parent.currentContext
35 }; 35 };
36 }, 36 },
37 computed: { 37 computed: {
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 methods: { 48 methods: {
49 compile () { 49 compile () {
50 if (this.column.render) { 50 if (this.column.render) {
51 - const $parent = this.content; 51 + const $parent = this.context;
52 const template = this.column.render(this.row, this.column, this.index); 52 const template = this.column.render(this.row, this.column, this.index);
53 const cell = document.createElement('div'); 53 const cell = document.createElement('div');
54 cell.innerHTML = template; 54 cell.innerHTML = template;
src/components/table/table.vue
@@ -142,7 +142,7 @@ @@ -142,7 +142,7 @@
142 return ''; 142 return '';
143 } 143 }
144 }, 144 },
145 - content: { 145 + context: {
146 type: Object 146 type: Object
147 }, 147 },
148 noDataText: { 148 noDataText: {
@@ -173,7 +173,7 @@ @@ -173,7 +173,7 @@
173 bodyHeight: 0, 173 bodyHeight: 0,
174 bodyRealHeight: 0, 174 bodyRealHeight: 0,
175 scrollBarWidth: getScrollBarSize(), 175 scrollBarWidth: getScrollBarSize(),
176 - currentContent: this.content, 176 + currentContext: this.context,
177 cloneData: deepCopy(this.data) // when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data 177 cloneData: deepCopy(this.data) // when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data
178 }; 178 };
179 }, 179 },
@@ -644,7 +644,7 @@ @@ -644,7 +644,7 @@
644 } 644 }
645 }, 645 },
646 created () { 646 created () {
647 - if (!this.content) this.currentContent = this.$parent; 647 + if (!this.context) this.currentContext = this.$parent;
648 this.showSlotHeader = this.$refs.title !== undefined; 648 this.showSlotHeader = this.$refs.title !== undefined;
649 this.showSlotFooter = this.$refs.footer !== undefined; 649 this.showSlotFooter = this.$refs.footer !== undefined;
650 this.rebuildData = this.makeDataWithSortAndFilter(); 650 this.rebuildData = this.makeDataWithSortAndFilter();