|
@@ -81,8 +81,20 @@ export default {
|
|
|
if (err) {
|
|
|
_this.$message.error("上传失败");
|
|
|
} else {
|
|
|
- console.log(file)
|
|
|
- _this.$emit('getFile',{fileName:file.name,url:data.Location})
|
|
|
+ let size = file.size;
|
|
|
+ let unit = "B"
|
|
|
+ if(size>1000000000){
|
|
|
+ size = size/1024/1024/1024;
|
|
|
+ unit = "G"
|
|
|
+ }else if(size>1000000){
|
|
|
+ size = size/1024/1024
|
|
|
+ unit = "MB"
|
|
|
+ }else if(size>1000){
|
|
|
+ size = size/1024
|
|
|
+ unit = "KB"
|
|
|
+ }
|
|
|
+ size = Math.floor(size);
|
|
|
+ _this.$emit('getFile',{fileName:file.name,size:`${size}${unit}`,url:data.Location})
|
|
|
console.log(data.Location);
|
|
|
}
|
|
|
});
|