|
@@ -1,11 +1,10 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
|
|
-import axios from 'axios';
|
|
|
|
|
-import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
+import {ref} from 'vue';
|
|
|
|
|
+import {ElMessage} from 'element-plus';
|
|
|
|
|
|
|
|
const uploadRef = ref(null);
|
|
const uploadRef = ref(null);
|
|
|
const fileList = ref([]); // 存储文件列表
|
|
const fileList = ref([]); // 存储文件列表
|
|
@@ -43,7 +42,7 @@ const submitUpload = () => {
|
|
|
|
|
|
|
|
// 发送请求
|
|
// 发送请求
|
|
|
request.post('https://api.example.com/upload', formData, {
|
|
request.post('https://api.example.com/upload', formData, {
|
|
|
- headers: { 'Content-Type': 'multipart/form-data' },
|
|
|
|
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'},
|
|
|
onUploadProgress: (e) => {
|
|
onUploadProgress: (e) => {
|
|
|
console.log(`进度: ${Math.round((e.loaded / e.total) * 100)}%`);
|
|
console.log(`进度: ${Math.round((e.loaded / e.total) * 100)}%`);
|
|
|
}
|
|
}
|