The parent component passes an object item to the child component. It is found that when using method one, each attribute in the item received in the child component will have an additional get/set method. If there are many attributes, method two is too annoying. Please ask an expert for advice. How did they do it
方法一:
<img-box :obj='item'></img-box>
方法二:
<img-box
:value='item.value'
:activeParam='item.activeParam'
:aimUrl='item.aimUrl'
:jumpType='item.jumpType'
:setTop='item.setTop'
:setWidth='item.setWidth'
:themeId='item.themeId'
:todocode='item.todocode'
:toolId='item.toolId'
:ttid='item.ttid'
></img-box>
扔个三星炸死你2017-06-15 09:25:17
<img-box :obj='item'></img-box>
let {value, activeParam, aimUrl, jumpType, setTop, setWidth, themeId, todocode, toolId, ttid} = item;
我想大声告诉你2017-06-15 09:25:17
Just pass an object directly, and then the sub-component uses the object to receive it
習慣沉默2017-06-15 09:25:17
Parent component: <img-box :obj='item'></img-box>
Child component: props:{
obj:{},
}
I will receive the item directly