27 lines
667 B
Vue
27 lines
667 B
Vue
<script lang="ts">
|
|
export default { inheritAttrs: false }
|
|
</script>
|
|
|
|
<script setup lang="ts">
|
|
/**
|
|
* This component makes it possible to optionally wrap around another component.
|
|
* It's based on these ideas:
|
|
*
|
|
* - https://github.com/vuejs/rfcs/pull/449
|
|
* - https://github.com/vuejs/rfcs/discussions/448#discussioncomment-2769396=
|
|
*/
|
|
defineProps<{
|
|
/**
|
|
* If the `is` prop defines a component it will be rendered as a wrapper around the slot content.
|
|
* If the `is` prop is undefined there won't be any wrapper.
|
|
*/
|
|
is: any,
|
|
}>()
|
|
</script>
|
|
|
|
<template>
|
|
<component v-if="is" :is="is" v-bind="$attrs">
|
|
<slot />
|
|
</component>
|
|
<slot v-else />
|
|
</template> |