rsuite-uploader
v2.1.1
Published
React component , Upload files async with xhr. Supporting IE9+.
Downloads
25
Readme
rsuite-uploader
支持IE9+异步上传的React上传组件。
快速开始
安装
npm install rsuite-uploader --save-dev
样式
在 less
文件中引入:
@import '~rsuite-uploader/lib/less/index';
示例代码
import Uploader from 'rsuite-uploader';
const options = {
timeout: 30e3,
name: 'sampleFile',
multiple: true,
fileNumLimit: 3,
baseUrl: '/upload',
accept: [
{
title: 'Images',
extensions: 'jpg,jpeg',
mimeTypes: 'image/jpeg'
},
{
title: 'Images',
extensions: 'png',
mimeTypes: 'image/png'
}
],
formData: {
test: 1
},
requestHeaders: {
'Company-Name': 'Hypers'
},
fileList: fileList,
validateError(e){
console.log(e);
},
uploadSuccess(response, file){
console.log('SUCCESS', response, file);
},
uploadError(error, file){
console.log('ERROR', error, file);
},
fileDeQueued(gid, file, files){
console.log(gid, file, files);
}
};
export default React.createClass({
render(){
return (
<Uploader {...options} />
);
}
});