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

slot中支持template标签么? #165

Closed
superwy opened this issue Nov 3, 2020 · 2 comments
Closed

slot中支持template标签么? #165

superwy opened this issue Nov 3, 2020 · 2 comments

Comments

@superwy
Copy link

superwy commented Nov 3, 2020

在slot中使用template标签不显示

const slots = { default: () => { <template> <NavMenuItem /> <NavMenuItem /> </template> } }

@Zcating
Copy link

Zcating commented Nov 20, 2020

使用模板的时候会把 <template> 渲染成 <Fragment>。在 jsx 中,你需要通过 import {Fragment} from 'vue'这种形式引入,并将其当作标签使用即可。
const slots = { default: () => { <Fragment> <NavMenuItem /> <NavMenuItem /> </Fragment> } }

@wpbjiuy
Copy link

wpbjiuy commented Nov 20, 2020

v-slots 只能在根节点下才起做用,而且<></>这怎么放呢? < v-slots={slots}></>这样吗?

@superwy superwy closed this as completed Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants