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 31 return {
32 32 renderType: '',
33 33 uid: -1,
34   - content: this.$parent.$parent.currentContent
  34 + context: this.$parent.$parent.currentContext
35 35 };
36 36 },
37 37 computed: {
... ... @@ -48,7 +48,7 @@
48 48 methods: {
49 49 compile () {
50 50 if (this.column.render) {
51   - const $parent = this.content;
  51 + const $parent = this.context;
52 52 const template = this.column.render(this.row, this.column, this.index);
53 53 const cell = document.createElement('div');
54 54 cell.innerHTML = template;
... ...
src/components/table/table.vue
... ... @@ -142,7 +142,7 @@
142 142 return '';
143 143 }
144 144 },
145   - content: {
  145 + context: {
146 146 type: Object
147 147 },
148 148 noDataText: {
... ... @@ -173,7 +173,7 @@
173 173 bodyHeight: 0,
174 174 bodyRealHeight: 0,
175 175 scrollBarWidth: getScrollBarSize(),
176   - currentContent: this.content,
  176 + currentContext: this.context,
177 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 644 }
645 645 },
646 646 created () {
647   - if (!this.content) this.currentContent = this.$parent;
  647 + if (!this.context) this.currentContext = this.$parent;
648 648 this.showSlotHeader = this.$refs.title !== undefined;
649 649 this.showSlotFooter = this.$refs.footer !== undefined;
650 650 this.rebuildData = this.makeDataWithSortAndFilter();
... ...