【发布时间】:2021-09-23 21:33:03
【问题描述】:
在 Vue JS 中,如何将一个组件作为另一个组件的 prop(或插槽)传递,同时能够从孙组件设置它自己的 props?
家长:
<template>
<Child>
<SomeComponent />
</Child>
</template>
孩子:
<template>
<GrandChild>
<slot></slot>
</GrandChild>
</template>
孙子:
<template>
<slot :content="content"></slot> //Setting the props of <SomeComponent/> here
</template>
【问题讨论】:
标签: vue.js vue-component vuejs3 vue-props