Using the comment node in the slot, no mounts occur on the dom
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
1、Create a default slot 2、Comment out the content inserted in the default slot
I set that option in the development environment, but it still behaves the same way
What is expected?
Note content appears on dom
What is actually happening?
Note content disappears and is not mounted
System Info
No response
Any additional comments?
link #7699
My original intent was to determine if the default slot was passed in, but I found that after commenting out the node, Boolean(useSlots().defult)
was still true. in the compiled content I see that the comment vnode is actually created, and if Boolean(useSlots(). defult)
behaves correctly, should I mount the comment vnode here as well?
slot.default is a function ,so Boolean(slot.default) always be true
interface ComponentPublicInstance { $slots: { [name: string]: Slot } }
type Slot = (...args: any[]) => VNode[]
@asuishi
But not always a function. However, what is confusing here is that since Boolean(useSlots(). defult
is true (annotated nodes are created), why dom is not mounted. I think there is a performance inconsistency here
Contrast Example
@asuishi 但并不总是一个功能。然而,这里令人困惑的是,既然
Boolean(useSlots(). defult
是真的(创建了注释节点),为什么没有挂载dom。我认为这里存在性能不一致 对比示例