Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the comment node in the slot, no mounts occur on the dom #7840

Open
puppet-666 opened this issue Mar 7, 2023 · 4 comments
Open

Using the comment node in the slot, no mounts occur on the dom #7840

puppet-666 opened this issue Mar 7, 2023 · 4 comments

Comments

@puppet-666
Copy link

Vue version

3.2.47

Link to minimal reproduction

https://sfc.vuejs.org/#eNp9UstOwzAQ/BXjS4tU2yogIVWmKo8rJ66+hGZLA/FDthOEovw76zwgDY9c4p2Z9aw9buitc7yugG6oDHtfuEgCxMptlSm0sz6Sx497iysDJpKDt5osuJhgqXmhjBR9N/ZhEUG7MouQqignagQIIYidMUZkXtQ9gN96ve6XUiSYMNZRcuqFiBRfe9MV7UdkOnP8NViDh2hSkxqIoOiGdEjCcNBUK3qM0YWNEJVxby98b7XYISd8ZWKhgeVW7y75Bb+6xklCnOIcgmbP3r4H8Oio6GqyuUCwBs88mBw8+H/NZtoTwxn3wzR5tsq0eAGzIH5JkQwxNlWAp9LG0A4p9rntrQkoRoLckFGyPB+JY1bDAxyyqkz8nbUlZGaZ5DzvYZT+mT3G9x2xTF1b1KZf9y66oGeqpplYtnjK8UGcRt9+Aj568No=

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

image

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?

@puppet-666
Copy link
Author

fe40053dc9ac651ced88a93145add13

@asuishi
Copy link

asuishi commented Mar 7, 2023

slot.default is a function ,so Boolean(slot.default) always be true

interface ComponentPublicInstance {
$slots: { [name: string]: Slot }
}

type Slot = (...args: any[]) => VNode[]

@puppet-666
Copy link
Author

puppet-666 commented Mar 7, 2023

@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

@VENI-VIDIVICI
Copy link

@asuishi 但并不总是一个功能。然而,这里令人困惑的是,既然Boolean(useSlots(). defult是真的(创建了注释节点),为什么没有挂载dom。我认为这里存在性能不一致 对比示例

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants