zan-upload
Advanced tools
Comparing version 5.0.2 to 5.0.4
@@ -29,2 +29,6 @@ 'use strict'; | ||
var _local_storage = require('zan-utils/browser/local_storage'); | ||
var _local_storage2 = _interopRequireDefault(_local_storage); | ||
var _ImageList = require('./ImageList'); | ||
@@ -61,2 +65,14 @@ | ||
_this.setCache = function () { | ||
_local_storage2['default'].setItem(_this.localStorgeKey, JSON.stringify(_this.state)); | ||
}; | ||
_this.getCache = function () { | ||
var data = _local_storage2['default'].getItem(_this.localStorgeKey); | ||
if (data) { | ||
data = JSON.parse(data); | ||
_this.setState(data); | ||
} | ||
}; | ||
_this.state = { | ||
@@ -69,2 +85,3 @@ mediaList: [], | ||
}; | ||
_this.localStorgeKey = 'widget-attachment-' + props.options.type + '-' + props.options.kdtId; | ||
_this.confirm = _this.confirm.bind(_this); | ||
@@ -80,2 +97,3 @@ _this.getMediaList = _this.getMediaList.bind(_this); | ||
value: function componentWillMount() { | ||
this.getCache(); | ||
this.getMediaList(); | ||
@@ -109,3 +127,3 @@ this.getCategoryList(); | ||
mediaList: data.dataList || [] | ||
}); | ||
}, _this2.setCache); | ||
}); | ||
@@ -130,3 +148,3 @@ } | ||
categoryList: data || [] | ||
}); | ||
}, _this3.setCache); | ||
}); | ||
@@ -133,0 +151,0 @@ } |
{ | ||
"name": "zan-upload", | ||
"version": "5.0.2", | ||
"version": "5.0.4", | ||
"description": "这是一个React组件", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -108,2 +108,3 @@ ## zan-upload | ||
mediaListUrl="mock/upload-mediaList.json" | ||
categoryListUrl="mock/upload-categoryList.json" | ||
onSuccess={this.uploadSuccess} />; | ||
@@ -294,1 +295,5 @@ } | ||
- 为 onProgress 增加上传过程中的预览图片 | ||
#### 5.0.3 (2017-11-24) | ||
- 素材银行分组增加localStorage缓存 |
Sorry, the diff of this file is too big to display
826090
22859
298