|
@@ -16,7 +16,7 @@ import "../common/aws-sdk-2.235.1.min.js";
|
|
|
import { getNowDate } from "./Date";
|
|
|
export default {
|
|
|
components: {},
|
|
|
- props: [ 'navName','accept'],
|
|
|
+ props: [ 'navName','accept','progress'],
|
|
|
data() {
|
|
|
return {
|
|
|
inputShow: true,
|
|
@@ -53,6 +53,7 @@ export default {
|
|
|
},
|
|
|
}); //选择桶
|
|
|
var _this = this;
|
|
|
+ _this.progress?_this.progress.show = true:'';
|
|
|
if (file) {
|
|
|
var params = {
|
|
|
Key:
|
|
@@ -73,11 +74,10 @@ export default {
|
|
|
bucket
|
|
|
.upload(params, options)
|
|
|
.on("httpUploadProgress", function (evt) {
|
|
|
- //这里可以写进度条
|
|
|
- // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
+ //进度条
|
|
|
+ _this.progress?_this.progress.value = Math.round((evt.loaded/evt.total)*100):'';
|
|
|
})
|
|
|
.send(function (err, data) {
|
|
|
- // loading.close();
|
|
|
_this.inputShow = true;
|
|
|
if (err) {
|
|
|
_this.$message.error("上传失败");
|
|
@@ -95,8 +95,11 @@ export default {
|
|
|
unit = "KB"
|
|
|
}
|
|
|
size = Math.floor(size);
|
|
|
- _this.$emit('getFile',{fileName:file.name,size:`${size}${unit}`,uploadTime:getNowDate(),url:data.Location})
|
|
|
- console.log(data.Location);
|
|
|
+ _this.$emit('getFile',{fileName:file.name,size:`${size}${unit}`,uploadTime:getNowDate(),url:data.Location})
|
|
|
+ if(_this.progress&&_this.progress.value==100){
|
|
|
+ _this.progress?_this.progress.show = false:"";
|
|
|
+ _this.progress?_this.progress.value=0:"";
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|