Vue slots after v-if are not showing in props table of Addon Docs.
See original GitHub issueSlots after v-if are not shown in props table of the addon “Docs”.
This example will produce a table props without the slots adolescent
neither adult
.
<slot v-if="age<=12" name="child">
<!-- something for children -->
</slot>
<slot v-else-if="age<=19" name="adolescent">
<!-- something for adolescents -->
</slot>
<slot v-else name="adult">
<!-- something for adults -->
</slot>
My real code is the following:
<!--
@slot Dynamic slot for individual body cell. X is the column and Y is the row.
<span class="d-block mt-3">Example: <pre class="mt-2"><code>body-x0y1</code></pre> will set the slot
for the cell in the column at index 0 and the row at index 1</span>
-->
<slot
v-if="$scopedSlots[`body-x${columnIndex}y${rowIndex}`]"
:name="`body-x${columnIndex}y${rowIndex}`"
:cell-data="cell">
{{ cell }}
</slot>
<!--
@slot Dynamic slot for all cells in a column of the table body.
<span class="d-block mt-3">Example: <pre class="mt-2"><code>body-column-0</code></pre> will set
all the cells of the column with index 0</span>
-->
<slot
v-else
:name="`body-column-${columnIndex}`"
:cell-data="cell">
{{ cell }}
</slot>
The documentation props result:
As you can see there isn’t the slot description for body-column-${columnIndex}
Is this a bug or am I missing something?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
storybook code preview doesn't show the usage of slots in ...
I solved this by removing the slot from the $props variable and simply passing it into the template with args.default ( default is...
Read more >Slots | Vue.js
Slot content is not just limited to text. It can be any valid template content. For example, we can pass in multiple elements,...
Read more >Select
The QSelect Vue component has two types of selection - single or multiple. This component opens up a menu for the selection list...
Read more >Using Slots In Vue.js
You can pass functions to scoped slots too. Many libraries use this to provide reusable functional components as you'll see later. v-slot has...
Read more >Nuxt - Built-in Components
The <Nuxt> component is the component you use to display your page components. ... To learn more about keep-alive and keep-alive-props see the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @ecarrera can you check that this issue still appears. version 4.31.1 of vue-docgen-api now uses the v3 parser.
Hello @ecarrera
Thank you for reporting. This is indeed a known issue.
https://github.com/vue-styleguidist/vue-styleguidist/issues/430
And ultimately this
https://github.com/vuejs/vue/pull/10286
In other words, the parser from vue 2 removes all comments between if and else. It makes them disappear from the parsed documentation.
I proposed a fix but it seems long forgotten now.
I will try and upgrade vue-docgen-api to the v3 compiler/parser to see if we can do better.