fix: table customRender fragment warning, close #5556

pull/5564/head
tangjinzhou 3 years ago
parent 9aeadaf877
commit 7789cb2989

@ -33,7 +33,7 @@ function inHoverRange(cellStartRow: number, cellRowSpan: number, startRow: numbe
function isRenderCell<RecordType = DefaultRecordType>( function isRenderCell<RecordType = DefaultRecordType>(
data: RenderedCell<RecordType>, data: RenderedCell<RecordType>,
): data is RenderedCell<RecordType> { ): data is RenderedCell<RecordType> {
return data && typeof data === 'object' && !Array.isArray(data) && !isValidElement(data); return data && typeof data === 'object' && !Array.isArray(data) && !isVNode(data);
} }
export interface CellProps<RecordType = DefaultRecordType> { export interface CellProps<RecordType = DefaultRecordType> {
@ -245,12 +245,8 @@ export default defineComponent<CellProps>({
} }
} }
// Not crash if final `childNode` is not validate ReactNode // Not crash if final `childNode` is not validate VueNode
if ( if (typeof childNode === 'object' && !Array.isArray(childNode) && !isVNode(childNode)) {
typeof childNode === 'object' &&
!Array.isArray(childNode) &&
!isValidElement(childNode)
) {
childNode = null; childNode = null;
} }

Loading…
Cancel
Save