Table: Fix static render fail

pull/2/head
qingwei.li 2016-08-30 15:36:21 +08:00
parent 1cb5b16262
commit d538f180fd
1 changed files with 15 additions and 9 deletions

View File

@ -94,11 +94,16 @@ export default {
data() { data() {
return { return {
isChildColumn: false, isChildColumn: false,
columns: [], columns: []
row: {}
}; };
}, },
beforeCreate() {
this.row = {};
this.column = {};
this.$index = 0;
},
components: { components: {
ElCheckbox, ElCheckbox,
ElTag ElTag
@ -137,8 +142,8 @@ export default {
let property = this.property; let property = this.property;
if (property) { if (property) {
template = function(h, { row }) { template = function(h, { row }, parent) {
return <span>{ this.$getPropertyText(row, property, columnId) }</span>; return <span>{ parent.$getPropertyText(row, property, columnId) }</span>;
}; };
} }
@ -161,12 +166,13 @@ export default {
let renderColumn = column.template; let renderColumn = column.template;
let _self = this; let _self = this;
column.template = function(h, data) { column.template = function(h, data) {
if (_self.$vnode.data.inlineTemplate) { if (_self.$vnode.data.inlineTemplate) {
let costomRender = _self.$options.render; let costomRender = _self.$options.render;
renderColumn = function(_h) { renderColumn = function() {
return costomRender.call(data, _h); return costomRender.call(objectAssign(_self, data));
}; };
}; };
@ -176,10 +182,10 @@ export default {
effect={ this.effect } effect={ this.effect }
placement="top" placement="top"
disabled={ this.tooltipDisabled }> disabled={ this.tooltipDisabled }>
<div class="cell">{ renderColumn.call(this._renderProxy, h, data) }</div> <div class="cell">{ renderColumn(h, data, this._renderProxy) }</div>
<span slot="content">{ renderColumn.call(this._renderProxy, h, data) }</span> <span slot="content">{ renderColumn(h, data, this._renderProxy) }</span>
</el-tooltip> </el-tooltip>
: <div class="cell">{ renderColumn.call(this._renderProxy, h, data) }</div>; : <div class="cell">{ renderColumn(h, data, this._renderProxy) }</div>;
}; };
this.columnConfig = column; this.columnConfig = column;