useForwardPropsEmits
useForwardProps & useEmitAsProps 的组合
这个组合式函数只是一个用于封装 useForwardProps 和 useEmitAsProps 组合式函数的包装器。这样做,它只返回一个设计用于直接与 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>