perf: 优化上传图片带域名时不增加前缀

This commit is contained in:
insistence
2024-10-22 19:36:27 +08:00
parent a3c9ffdad5
commit d0211cfd11

View File

@@ -47,6 +47,7 @@
<script setup> <script setup>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { isExternal } from "@/utils/validate";
const props = defineProps({ const props = defineProps({
modelValue: [String, Object, Array], modelValue: [String, Object, Array],
@@ -93,7 +94,7 @@ watch(() => props.modelValue, val => {
// 然后将数组转为对象数组 // 然后将数组转为对象数组
fileList.value = list.map(item => { fileList.value = list.map(item => {
if (typeof item === "string") { if (typeof item === "string") {
if (item.indexOf(baseUrl) === -1) { if (item.indexOf(baseUrl) === -1 && !isExternal(item)) {
item = { name: baseUrl + item, url: baseUrl + item }; item = { name: baseUrl + item, url: baseUrl + item };
} else { } else {
item = { name: item, url: item }; item = { name: item, url: item };