为了账号安全,请及时绑定邮箱和手机立即绑定

vue中props传值的问题?

vue中props传值的问题?

小怪兽爱吃肉 2018-11-15 14:15:40
父组件给子组件传递一个对象item,发现用方法一的时候子组件中接收到的item里每个属性都会多出get/set方法,如果属性比较多方法二太烦了,请教大神们是怎么做的方法一:<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>
查看完整描述

1 回答

?
料青山看我应如是

TA贡献1772条经验 获得超8个赞

<img-box :obj='item'></img-box>

let {value, activeParam, aimUrl, jumpType, setTop, setWidth, themeId, todocode, toolId,  ttid} = item;


查看完整回答
反对 回复 2018-12-21
  • 1 回答
  • 0 关注
  • 446 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信