Reputation: 1984
I was reading nuxt-content docs about useUnwrap() composable. It says that the functionality is the same as unwrap prop in <ContentSlot>
component. But the docs does not give any example about using this composable. For example if I have a component called TestContent.vue
in /components/content/TestContent.vue
directory with the code below:
<template>
<div>
<h2 class="fancy-header"><ContentSlot :use="$slots.default" ref="element"/></h2>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
const element = ref(null)
onMounted(() => {
useUnwrap("p", element);
})
</script>
How could I use useUnwrap
composable to unwrap p tags in this component? The code I wrote is just my try to understand that and does not work at all!
Upvotes: 0
Views: 99