backdrop
工具

useForwardProps

在不进行布尔值转换的情况下传递组件的 props

为组件构建封装器时,在某些情况下你可能希望忽略 Vue 的 Props 布尔值转换

你可以为所有布尔字段设置默认值为 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>