Commit 080f5af5 authored by 张冬's avatar 张冬

更新

parent 90d666b3
......@@ -123,7 +123,9 @@ export default {
// 调用 ali-oss 中的方法
put(`${objName}${option.file.name}`, option.file).then(res => {
console.log(res)
this.fileList.push(res)
console.log(this.fileList)
this.emitInput(this.fileList)
})
}
......
......@@ -17,7 +17,7 @@
<script>
import {
put,
client1,
getFileNameUUID
} from '@api/ali-oss' //前面的ali-js文件内的两个封装函数
......@@ -26,7 +26,7 @@ import {
props: {
limit: {
type: Number,
default: 1
default: 5
}
},
data() {
......@@ -55,10 +55,13 @@ import {
return this.$confirm(`确定移除 ${file.name}?`);
},
// 文件列表移除文件时的钩子
handleRemove(file, fileList) {},
handleRemove(file, fileList) {
this.progress=0
},
// 文件上传成功时的钩子
handleSuccess(response, file, fileList) {
this.fileList = fileList;
this.$emit('onsuccess', fileList)
},
//文件上传前的校验
beforeAvatarUpload(file) {
......@@ -82,16 +85,14 @@ import {
fileNameLength
);
let fileName = getFileNameUUID() + "." + fileFormat;
client1(that.dataObj)
.multipartUpload(`videoTest/${fileName}`, file.file, {
client1(that.dataObj).multipartUpload(`videoTest/${fileName}`, file.file, {
progress: function(p) {
//p进度条的值
console.log(p);
that.showProgress = true;
that.progress = Math.floor(p * 100);
}
})
.then(result => {
}).then(result => {
//上传成功返回值,可针对项目需求写其他逻辑
console.log(result);
})
......
<template>
<div>
<div class="content">
<upload></upload>
<upload @onsuccess="\"></upload>
<div @click="up">上传</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment