|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="upload">
|
|
|
- <el-upload v-if="hidden" :action="action" :headers="headers" :multiple="multiple" :data="data"
|
|
|
+ <el-upload v-if="hidden" :action="newAction" :headers="headers" :multiple="multiple" :data="data"
|
|
|
:show-file-list="showFileList" :accept="accept" :list-type="listType" :on-progress="onProgress"
|
|
|
:on-error="onError" :on-success="onSuccess" :before-upload="beforeUpload" :disabled="disabled">
|
|
|
<el-button v-if="listType === 'text'" :type="btnType">{{ newTitle }}</el-button>
|
|
@@ -18,6 +18,8 @@
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
export default {
|
|
|
props: {
|
|
|
+ // 接口地址
|
|
|
+ action: String,
|
|
|
// 图片
|
|
|
url: String,
|
|
|
// 类型
|
|
@@ -60,7 +62,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
// 上传地址
|
|
|
- action: this.listType === 'text' ? `${process.env.VUE_APP_BASE_API}/system/file/file/upload` : `${process.env.VUE_APP_BASE_API}/system/file/picture/upload`,
|
|
|
+ newAction: this.action !== undefined ? process.env.VUE_APP_BASE_API + this.action : this.listType === 'text' ? `${process.env.VUE_APP_BASE_API}/system/file/file/upload` : `${process.env.VUE_APP_BASE_API}/system/file/picture/upload`,
|
|
|
// 请求头
|
|
|
headers: {
|
|
|
Authorization: "Bearer " + getToken(),
|