publish 2.1.2

This commit is contained in:
yangchch6 2020-04-08 12:02:14 +08:00
parent e5063760c7
commit 5b4739799b
3 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,8 @@
<a name="2.1.2"></a>
## [2.1.2](https://github.com/tinper-bee/upload/compare/v2.1.1...v2.1.2) (2020-04-08)
<a name="2.1.1"></a>
## [2.1.1](https://github.com/tinper-bee/upload/compare/v2.1.0...v2.1.1) (2020-01-17)

View File

@ -147,8 +147,9 @@ var propTypes = {
onChange: _propTypes2["default"].func,
listType: _propTypes2["default"].oneOf(['text', 'picture', 'picture-card']),
className: _propTypes2["default"].string,
// onPreview: PropTypes.func,
onPreview: _propTypes2["default"].func,
onRemove: _propTypes2["default"].func,
preventDefaultPreview: _propTypes2["default"].bool,
supportServerRender: _propTypes2["default"].bool,
style: _propTypes2["default"].object,
disabled: _propTypes2["default"].bool,
@ -170,6 +171,7 @@ var defaultProps = {
className: '',
disabled: false,
supportServerRender: true,
preventDefaultPreview: false,
enterDragger: function enterDragger() {},
leaveDragger: function leaveDragger() {}
};
@ -321,16 +323,27 @@ var Upload = function (_Component) {
};
_this.handlePreview = function (file) {
var _this$props = _this.props,
onPreview = _this$props.onPreview,
preventDefaultPreview = _this$props.preventDefaultPreview;
var displayPreview = function displayPreview() {
_this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true
});
};
if (!file.url && !file.thumbUrl) {
getBase64(file.originFileObj).then(displayPreview);
} else {
displayPreview();
if (preventDefaultPreview === false) {
if (!file.url && !file.thumbUrl) {
getBase64(file.originFileObj).then(displayPreview);
} else {
displayPreview();
}
}
if (onPreview && Object.prototype.toString.call(onPreview) === "[object Function]") {
onPreview(file);
}
};

View File

@ -1,6 +1,6 @@
{
"name": "bee-upload",
"version": "2.1.1",
"version": "2.1.2",
"description": "upload ui component for react",
"keywords": [
"react",