Reka UI 徽标Reka
backdrop
实用工具

useForwardProps

转发组件属性,不进行布尔值强制转换

当您为组件构建包装器时,在某些情况下您会希望忽略 Vue 的属性布尔值强制转换

您可以将所有布尔字段的默认值设置为 undefined,也可以使用此可组合函数。

用法

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

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

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