useForwardPropsEmits
useForwardProps 与 useEmitAsProps 的组合。
这个组合式函数只是 useForwardProps 和 useEmitAsProps 组合式函数的包装器。这样做它只返回一个对象,该对象旨在直接与 v-bind 一起使用。
用法
<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>