You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
578 B
Vue

<template>
<div class="info">
<header>
<button v-for="(_, slot) in slots"
:key="slot"
@click="shownSlot = slot"
class="app-menu-button"
:class="{ highlighted: shownSlot === slot }"
>
{{ slot }}
</button>
</header>
<slot :name="shownSlot"></slot>
</div>
</template>
<script setup>
import { ref, useSlots } from 'vue'
const props = defineProps({
defaultSlot: {
type: String,
},
})
const slots = useSlots()
const shownSlot = ref(props.defaultSlot || Object.keys(slots)[0] || 'default')
</script>