|
@@ -14,8 +14,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { UploadRawFile, UploadRequestOptions } from "element-plus";
|
|
|
-import { uploadFileApi } from "@/api/file";
|
|
|
+import { uploadFileApi, deleteFileApi } from "@/api/file";
|
|
|
+import {
|
|
|
+ UploadRawFile,
|
|
|
+ UploadRequestOptions,
|
|
|
+ UploadUserFile,
|
|
|
+ UploadFile,
|
|
|
+ UploadProps,
|
|
|
+} from "element-plus";
|
|
|
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
@@ -33,8 +39,8 @@ const imgUrl = useVModel(props, "modelValue", emit);
|
|
|
* @param options
|
|
|
*/
|
|
|
async function uploadFile(options: UploadRequestOptions): Promise<any> {
|
|
|
- const { data: fileInfo } = await uploadFileApi(options.file);
|
|
|
- imgUrl.value = fileInfo.url;
|
|
|
+ const res = await uploadFileApi(options.file);
|
|
|
+ imgUrl.value = import.meta.env.VITE_APP_UPLOAD_URL + res.data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -53,6 +59,7 @@ function handleBeforeUpload(file: UploadRawFile) {
|
|
|
.single-uploader {
|
|
|
overflow: hidden;
|
|
|
cursor: pointer;
|
|
|
+ display: inline-block;
|
|
|
border: 1px var(--el-border-color) solid;
|
|
|
border-radius: 6px;
|
|
|
|