fix(table): avoiding the error of el-table-column rendering (#828)

fix #793

Co-authored-by: winerlu <winerlu@tencent.com>
This commit is contained in:
justwiner 2020-12-07 10:35:42 +08:00 committed by GitHub
parent 977767e2e7
commit 88ad652172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,9 +88,6 @@ export default defineComponent({
const instance = getCurrentInstance() as TableColumn
const columnConfig = ref({})
const props = (prop as unknown) as TableColumnCtx
const row = ref({})
const r = ref({})
const $index = ref(0)
const owner = computed(() => {
let parent = instance.parent as any
while (parent && !parent.tableId) {
@ -202,24 +199,22 @@ export default defineComponent({
// eslint-disable-next-line
instance.columnConfig = columnConfig
return {
row,
r,
$index,
columnId,
columnConfig,
}
return
},
render() {
return h(
'div',
this.$slots.default?.({
store: {},
_self: {},
column: {},
row: {},
$index: undefined,
}),
)
try {
return h(
'div',
this.$slots.default?.({
store: {},
_self: {},
column: {},
row: {},
$index: -1,
}),
)
} catch {
return h('div')
}
},
})