我想将对象中的所有属性作为 传递props,并且v-bind不带参数使用。
但是如何props在不必在子组件中声明道具的情况下获得子组件?
例如,在下面的代码中item是一个对象。
父组件:
<div v-for="item in domArr" :key="item.id">
<cus-dom v-bind="item"></cus-dom>
</div>
Run Code Online (Sandbox Code Playgroud)
子组件:
<script>
export default {
name: 'cusDom',
props: [], // HOW TO GET THE props, because I have it empty/no arguments HERE?
data() {
return {};
},
mounted() {
}
}
</script>
Run Code Online (Sandbox Code Playgroud)