Skip to content

Commit c1454bc

Browse files
huiliangShenbanruo
and
banruo
authored
fix(carousel): can not use jsx render children (#7077)
Co-authored-by: banruo <[email protected]>
1 parent 6140214 commit c1454bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/_util/vnode.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { filterEmpty } from './props-util';
22
import type { VNode, VNodeProps } from 'vue';
3-
import { cloneVNode } from 'vue';
3+
import { cloneVNode, isVNode } from 'vue';
44
import warning from './warning';
55
import type { RefObject } from './createRef';
66
type NodeProps = Record<string, any> &
@@ -40,6 +40,10 @@ export function deepCloneElement<T, U>(
4040
if (Array.isArray(vnode)) {
4141
return vnode.map(item => deepCloneElement(item, nodeProps, override, mergeRef));
4242
} else {
43+
// 需要判断是否为vnode方可进行clone操作
44+
if (!isVNode(vnode)) {
45+
return vnode;
46+
}
4347
const cloned = cloneElement(vnode, nodeProps, override, mergeRef);
4448
if (Array.isArray(cloned.children)) {
4549
cloned.children = deepCloneElement(cloned.children as VNode<T, U>[]);

0 commit comments

Comments
 (0)