Reputation: 9549
Take the code below as an example:
<header>
<slot name='header'></slot>
<template v-if='?'>
<h1>{{ someInput }}</h1>
</template>
</header>
I want to show the <h1>{{ some input }}</h1>
if nothing gets passed through the slots. What could I use as the condition in v-if
?
Upvotes: 2
Views: 1910
Reputation: 14168
This is enough:
<header>
<slot name='header'>
<h1>{{ someInput }}</h1>
</slot>
</header>
Anything originally inside the tags is considered fallback content. Fallback content is compiled in the child scope and will only be displayed if the hosting element is empty and has no content to be inserted.
From docs.
Upvotes: 2