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

更新

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