fix(components): [table] throw error when no matching column (#9682)

* Cannot read properties of null (reading 'id')

* fix(components): [table] fix Cannot read properties of null (reading 'id')
This commit is contained in:
热爱vue的小菜鸟 2022-09-07 15:50:40 +08:00 committed by GitHub
parent 2dc30791a0
commit 6218e4ddc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
import { createPopper } from '@popperjs/core'
import { get } from 'lodash-unified'
import escapeHtml from 'escape-html'
import { hasOwn } from '@element-plus/utils'
import { hasOwn, throwError } from '@element-plus/utils'
import { useZIndex } from '@element-plus/hooks'
import type {
IPopperOptions,
@ -120,6 +120,8 @@ export const getColumnByKey = function <T>(
break
}
}
if (!column)
throwError('ElTable', `No column matching with column-key: ${columnKey}`)
return column
}