Custom Components
<template>
<div>
<slot/>
<slot name="test"/>
</div>
</template>
<script lang="ts" setup>
import { useSlots } from "vue";
// Check whether
has passed a value
constslotDefault = !! useSlots().default;// Check whether
is passed
constslotTest = !! useSlots().test;</script>
Copy the code
use
<template>
<test-a>
<div>The default content</div>
<template v-slot:test>The test content</template>
</test-a>
</template>
<script lang="ts" setup>
</script>
Copy the code