Skip to content

Commit

Permalink
fix(carousel): can not use jsx render children (#7077)
Browse files Browse the repository at this point in the history
Co-authored-by: banruo <[email protected]>
  • Loading branch information
huiliangShen and banruo authored Nov 11, 2023
1 parent 6140214 commit c1454bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/_util/vnode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { filterEmpty } from './props-util';
import type { VNode, VNodeProps } from 'vue';
import { cloneVNode } from 'vue';
import { cloneVNode, isVNode } from 'vue';
import warning from './warning';
import type { RefObject } from './createRef';
type NodeProps = Record<string, any> &
Expand Down Expand Up @@ -40,6 +40,10 @@ export function deepCloneElement<T, U>(
if (Array.isArray(vnode)) {
return vnode.map(item => deepCloneElement(item, nodeProps, override, mergeRef));
} else {
// 需要判断是否为vnode方可进行clone操作
if (!isVNode(vnode)) {
return vnode;
}
const cloned = cloneElement(vnode, nodeProps, override, mergeRef);
if (Array.isArray(cloned.children)) {
cloned.children = deepCloneElement(cloned.children as VNode<T, U>[]);
Expand Down

0 comments on commit c1454bc

Please sign in to comment.