From bbd112d5a31d39a144518f436580bba688e3418a Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Fri, 18 Apr 2025 13:25:28 +0800
Subject: [PATCH] 支持文件&图片组件自定义地址&参数
---
ruoyi-ui/src/components/FileUpload/index.vue | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue
index 03c3d55..7b4fe12 100644
--- a/ruoyi-ui/src/components/FileUpload/index.vue
+++ b/ruoyi-ui/src/components/FileUpload/index.vue
@@ -5,6 +5,7 @@
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
+ :data="data"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
@@ -48,6 +49,15 @@
props: {
// 值
value: [String, Object, Array],
+ // 上传接口地址
+ action: {
+ type: String,
+ default: "/file/upload"
+ },
+ // 上传携带的参数
+ data: {
+ type: Object
+ },
// 数量限制
limit: {
type: Number,
@@ -78,7 +88,7 @@
return {
number: 0,
uploadList: [],
- uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传文件服务器地址
+ uploadFileUrl: process.env.VUE_APP_BASE_API + this.action, // 上传文件服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
@@ -152,7 +162,7 @@
// 上传失败
handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试");
- this.$modal.closeLoading()
+ this.$modal.closeLoading();
},
// 上传成功回调
handleUploadSuccess(res, file) {
--
Gitblit v1.9.3