コンテンツに移動

useForwardProps

ブーリアンキャストせずにコンポーネントのプロップを転送します。

コンポーネントのラッパーを作成する場合、Vue の プロップブーリアンキャストを無視するケースがあります。

すべてのブールフィールドの既定値を undefined に設定するか、このコンポーザブルを使用できます。

使用方法

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

const props = defineProps<CompEmitProps>()
const forwarded = useForwardProps(props)
</script>

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