-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
use of flatUnwrap and ContentSlot[unwrap] per the docs doesn't iterate properly through content #2372
Comments
The only work around I found for this is to pin version to |
Any news on this? I'd also wish the docs would cover how to use it. I had no idea how the list should look like in my markdown and thought you'd do something like this
the markdown side on how to use named slots other than "default" is also not covered |
I'm having the same issue, right now im worndering if I should use two components or props to print the list items, but as of now, the iteration of list items using |
This implementation has been broken over a year now - behaves contrary to the docs and doesn't iterate list items properly. |
Hello, I have also been having this issue. I came up with a workaround of making my List component from scratch: <script setup lang="ts">
const { flatUnwrap, unwrap } = useUnwrap()
import { resolveComponent } from 'vue';
const slots = useSlots();
function renderListElements() {
return flatUnwrap(slots.default!(), ['ul']
).map((element: any) => h(resolveComponent('MDCSlot'), { use: () => element, unwrap: 'li' }));
}
</script>
<template>
<ul class="not-prose">
<li v-for="el in renderListElements()">
<Icon name="tabler:check" />
<span>
<component :is="() => unwrap(el, ['li'])" />
</span>
</li>
</ul>
</template> |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Environment
Reproduction
https://stackblitz.com/edit/nuxt-starter-zfuxp6?file=content%2Findex.md,components%2Fcontent%2FcontentList.vue
Describe the bug
Using the useUnwrap composable to unpack and re-render a list from a markdown file no longer effectively iterates through list items in the pass-through of the used slot from the iteration through flatUnwrap into the ContentSlot component.
The v-for iteration runs through the correct number of items, but the ContentSlot :use and unwrap parameters have no effect on the output, and the whole content of the list is rendered into each item rather than a single item.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: