From 3041104f4d150687749ddadef2eef49f78fab1b7 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期六, 11 五月 2024 20:57:34 +0800
Subject: [PATCH] 仓库
---
src/components/scUpload/index.vue | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/components/scUpload/index.vue b/src/components/scUpload/index.vue
index 113b722..15744dc 100644
--- a/src/components/scUpload/index.vue
+++ b/src/components/scUpload/index.vue
@@ -78,7 +78,7 @@
disabled: { type: Boolean, default: false },
round: { type: Boolean, default: false },
onSuccess: { type: Function, default: () => { return true } },
-
+ host: {type: String, default: ''},
cropper: { type: Boolean, default: false },
compress: {type: Number, default: 1},
aspectRatio: {type: Number, default: NaN}
@@ -95,7 +95,8 @@
height: this.height + "px"
},
cropperDialogVisible: false,
- cropperFile: null
+ cropperFile: null,
+ hostNew: ''
}
},
watch:{
@@ -108,15 +109,23 @@
}
},
mounted() {
- this.value = this.modelValue
- this.newFile(this.modelValue)
+ this.getHost().then(res => {
+ this.value = this.modelValue
+ this.newFile(this.modelValue)
+ })
},
methods: {
+ getHost () {
+ if (this.host) return this.hostNew = this.host
+ return this.$API.setting.component.getImgHost.get().then(res => {
+ this.hostNew = res.data + '/visual/'
+ })
+ },
newFile(url){
if(url){
this.file = {
status: "success",
- url: url
+ url: `${this.hostNew}${url}`
}
}else{
this.file = null
@@ -198,7 +207,11 @@
success(res, file){
//閲婃斁鍐呭瓨鍒犻櫎blob
URL.revokeObjectURL(file.tempFile)
- delete file.tempFile
+ try {
+ delete file.tempFile
+ } catch (error) {
+
+ }
var os = this.onSuccess(res, file)
if(os!=undefined && os==false){
this.$nextTick(() => {
--
Gitblit v1.9.3