【发布时间】:2022-12-03 22:26:34
【问题描述】:
在反应中我可以声明一些对象......
const shared_props = {
prop1: 'value1',
prop2: 'value2',
prop3: 'value3',
};
...然后像这样将它传递给几个子组件:
<ChildComponent1 {...shared_props} />
<ChildComponent2 {...shared_props} />
<ChildComponent3 {...shared_props} />
我怎样才能在 Vue 中做到这一点?
请注意,我对 v-bind:shared_props="shared_props" 不感兴趣,因为它不一样。
【问题讨论】:
标签: reactjs vue.js vuejs2 vuejs3