コンテンツにスキップ

useForwardPropsEmits

useForwardProps と useEmitAsProps の組み合わせ

このコンポーザブルは単に useForwardProps コンポーザブルおよび useEmitAsProps コンポーザブルのラッパーです。これにより、v-bind で直接使用するために設計された 1 つのオブジェクトのみが返されます。

使用

vue
<script setup lang="ts">
import { useForwardPropsEmits } from 'radix-vue'

const props = defineProps<CompEmitProps>()
const emits = defineEmits<CompEmitEmits>()
const forwarded = useForwardPropsEmits(props, emits)
</script>

<template>
  <Comp v-bind="forwarded">
    ...
  </Comp>
</template>