* parent.vue
<template>
<div>
<CHild :config="config"></CHild>
</div>
</template>
<script>
export default {
data() {
return {
config: {
type: "component",
label: "组件",
value: 0
}
};
}
};
</script>
- child.vue
<template>
<div>type:{{ type }} label:{{ label }} value:{{ value }}</div>
</template>
<script>
export default {
props: {
type: String,
label: String,
value: Number
}
};
</script>
我想在parent.vue 传递 config 的时候就把它解构,child 接受对应的普通类型值.
求教大佬怎么操作?
试试
<CHild v-bind="config"></CHild>