Comparing version 4.4.4 to 5.0.0
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -329,3 +331,3 @@ | ||
if (item[optionValue] === id) { | ||
item.img_url = (0, _fullfillImage2['default'])(imageUrl[0].attachmentUrl || imageUrl[0].attachment_url, '!100x100.jpg'); | ||
item.img_url = imageUrl[0].attachmentUrl || imageUrl[0].attachment_url; | ||
} | ||
@@ -359,3 +361,4 @@ }); | ||
sku = _props2.sku, | ||
hasSKUImage = _props2.hasSKUImage; | ||
hasSKUImage = _props2.hasSKUImage, | ||
uploadConfig = _props2.uploadConfig; | ||
@@ -423,6 +426,5 @@ | ||
_react2['default'].createElement('img', { | ||
src: item.img_url, | ||
src: (0, _fullfillImage2['default'])(item.img_url, '!100x100.jpg'), | ||
role: 'presentation', | ||
alt: '', | ||
'data-src': item.img_url, | ||
onClick: _this5.handleImagePreview.bind(_this5, index) | ||
@@ -432,3 +434,3 @@ }), | ||
_zanUpload2['default'], | ||
{ | ||
_extends({ | ||
triggerClassName: 'img-edit', | ||
@@ -438,3 +440,3 @@ materials: true, | ||
onSuccess: _this5.uploadSuccess.bind(_this5, item[optionValue]) | ||
}, | ||
}, uploadConfig), | ||
_react2['default'].createElement( | ||
@@ -448,7 +450,7 @@ 'span', | ||
_zanUpload2['default'], | ||
{ | ||
_extends({ | ||
materials: true, | ||
maxAmount: '1', | ||
onSuccess: _this5.uploadSuccess.bind(_this5, item[optionValue]) | ||
}, | ||
}, uploadConfig), | ||
_react2['default'].createElement( | ||
@@ -455,0 +457,0 @@ 'i', |
@@ -186,3 +186,4 @@ 'use strict'; | ||
index = _props2.index, | ||
skuTree = _props2.skuTree; | ||
skuTree = _props2.skuTree, | ||
uploadConfig = _props2.uploadConfig; | ||
var _context2 = this.context, | ||
@@ -240,2 +241,3 @@ optionValue = _context2.optionValue, | ||
hasSKUImage: hasSKUImage, | ||
uploadConfig: uploadConfig, | ||
onSKULeafChange: this.onSKULeafChange | ||
@@ -242,0 +244,0 @@ }), |
@@ -163,3 +163,4 @@ 'use strict'; | ||
onCreateGroup = _props.onCreateGroup, | ||
disabled = _props.disabled; | ||
disabled = _props.disabled, | ||
uploadConfig = _props.uploadConfig; | ||
var _state = this.state, | ||
@@ -179,2 +180,3 @@ skuTree = _state.skuTree, | ||
skuTree: [].concat(skuTree), | ||
uploadConfig: uploadConfig, | ||
onSKUChange: _this3.rebuildSKU, | ||
@@ -219,3 +221,4 @@ onSKUDelete: _this3.deleteSKU.bind(_this3, index), | ||
onChange: _propTypes2['default'].func, | ||
prefix: _propTypes2['default'].string | ||
prefix: _propTypes2['default'].string, | ||
uploadConfig: _propTypes2['default'].object | ||
}; | ||
@@ -237,3 +240,4 @@ | ||
onChange: noop, | ||
prefix: 'rc' | ||
prefix: 'rc', | ||
uploadConfig: {} | ||
}; | ||
@@ -240,0 +244,0 @@ |
{ | ||
"name": "zan-sku", | ||
"version": "4.4.4", | ||
"version": "5.0.0", | ||
"description": "这是一个React组件", | ||
@@ -18,3 +18,3 @@ "repository": "url/to/your/component", | ||
"dependencies": { | ||
"zan-upload": "^4.5.3", | ||
"zan-upload": "^5.0.0", | ||
"zan-utils": "^1.0.7" | ||
@@ -21,0 +21,0 @@ }, |
@@ -59,3 +59,12 @@ ## zan-sku | ||
render() { | ||
return <SKU onFetchGroup={this.fetchSKUTree} onFetchSKU={this.fetchSKU} />; | ||
return ( | ||
<SKU | ||
onFetchGroup={this.fetchSKUTree} | ||
onFetchSKU={this.fetchSKU} | ||
uploadConfig={{ | ||
tokenUrl: '//materials.youzan.com/dock/token.json', | ||
fetchUrl: '//materials.youzan.com/dock/fetch.json' | ||
}} | ||
/> | ||
); | ||
} | ||
@@ -82,2 +91,3 @@ } | ||
| skuTree | 可选的规格列表 | array | `[]` | | | ||
| uploadConfig | 自定义上传图片参数 | object | {} | | | ||
| optionValue | 自定义sku的id的key值 | string | `'id'` | | | ||
@@ -205,1 +215,7 @@ | optionText | 自定义sku的文案的key值 | string | `'text'` | | | ||
### 更新日志 | ||
#### 5.0.0 (2017-11-30) | ||
- 升级upload版本,新增uploadConfig来配置上传图片的参数 | ||
- sku图片地址改为原图地址 |
Sorry, the diff of this file is too big to display
995409
28123
219
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedre-resizable@4.11.0(transitive)
+ Addedreact-draggable@3.3.2(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-rnd@7.1.5(transitive)
+ Addedzan-upload@5.5.5(transitive)
- Removedzan-upload@4.5.3(transitive)
Updatedzan-upload@^5.0.0