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
Supported slot from Component's inside? #19
Comments
any update? |
|
I'm not sure if I understand the original request... |
For example normal <Tab>
<TabHead slot="tabhead">
...
</TabHead>
</Tab> Expect defining from component's inside as well: // TabHead.js
const TabHead = {
name: 'TabHead',
render(h) {
return(
<div slot="tabhead">
...
</div>
)
}
} |
@rwu823, you can achieve that by doing: export default {
render () {
return (
<div>
{this.$slots.tabhead
? <this.$slots.tabhead />
: <h1>Your content here</h1>}
</div>
)
}
} instead of: export default {
render () {
return (
<div slot="tabhead">
<h1>Your content here</h1>
</div>
)
}
} |
Wow, that actually worked! I was trying to do this: <VBreadcrumbs
class={{ "pl-0": true, [breadcrumbsStyle.root]: true }}
scopedSlots={{
item: ({ item }) => (
<VBreadcrumbsItem>
<VBtn
link
elevation={0}
small
color="transparent"
class="px-2"
onClick={() => {
console.log(item);
}}
>
{item.text}
</VBtn>
</VBreadcrumbsItem>
),
}}
slots={{
divider: () => [<VIcon>{mdiChevronRight}</VIcon>],
}}
items={this.breadcrumbs}
>
</VBreadcrumbs> But this actually worked: <VBreadcrumbs
class={{ "pl-0": true, [breadcrumbsStyle.root]: true }}
// divider={<VIcon>{mdiChevronRight}</VIcon>}
scopedSlots={{
item: ({ item }) => (
<VBreadcrumbsItem>
<VBtn
link
elevation={0}
small
color="transparent"
class="px-2"
onClick={() => {
console.log(item);
}}
>
{item.text}
</VBtn>
</VBreadcrumbsItem>
),
}}
items={this.breadcrumbs}
>
<div slot="divider">
<VIcon>{mdiChevronRight}</VIcon>
</div>
</VBreadcrumbs> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In some nested components case, we don't want to pass
slot
from outside, cloud we defined in component first?The text was updated successfully, but these errors were encountered: