共计 168 个字符,预计需要花费 1 分钟才能阅读完成。
Vue3 中的透传 Attributes / $attrs:简化组件开发的利器
<template>
<div>
<component :is="dynamicComponent" v-bind="$attrs" />
</div>
</template>
<script setup>
const dynamicComponent = ‘ChildComponent’;
正文完
共计 168 个字符,预计需要花费 1 分钟才能阅读完成。
Vue3 中的透传 Attributes / $attrs:简化组件开发的利器
<template>
<div>
<component :is="dynamicComponent" v-bind="$attrs" />
</div>
</template>
<script setup>
const dynamicComponent = ‘ChildComponent’;