这里是es6的新手。有没有办法用es6功能缩短这段代码?我正在尝试从一个对象中进行构造,并将这些拉出的属性放入一个新对象中。
const body = { Height, Width, Location, MapAttachmentTypes, ZoomLevelAdjustment, CustomPushPins, CenterPushpinStyle, ScaleFactor } = args;
我尝试了这个,但它不起作用:
<div ng-app="app" ng-controller="ApptStatusCtrl">
<select ng-model="MODEL_COL_FIELD" ui-grid-editor>
<option value="2"><img height='20px'
src='http://cdn.flaticon.com/png/256/70689.png'></option>
<option value="3"><img height='20px'
src='http://cdn.flaticon.com/png/256/70689.png'></option>
<option value="4"><img height='20px'
src='http://cdn.flaticon.com/png/256/70689.png'></option>
</select>
</div>
答案 0 :(得分:-3)
// new syntax
const body = {
...args
};
// es5
const body = Object.assign({}, args);