##功能
- 七牛分片上传
npm i qiniu-web-uploader
import Uploader from 'qiniu-web-uploader';
/*
uptoken:
{
uptoken: 'asdfsdf', //七牛上传凭证
key: 'sdfa' //base64字符串,new Buffer(key).toString('base64')
}
*/
let uploader = new Uploader(file, uptoken);
uploader.on('progress', () => {
console.log(uploader.percent); //加载进度
console.log(uploader.offset); //字节
console.log(uploader.file); //文件
});
uploader.on('cancel', () => {
//取消
});
uploader.on('complete', () => {
console.log(uploader.imgRes); //文件
});
let imgRes = await uploader.upload(); //返回七牛返回的Key
uploader.cancel(); //取消