backdrop
工具

useForwardPropsEmits

组合了 useForwardProps 和 useEmitAsProps 的功能

此组合式函数仅是 useForwardPropsuseEmitAsProps 组合式函数的封装。它返回一个专门设计用于直接配合 v-bind 使用的单一对象。

用法

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

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

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