|
@@ -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 @@ export default {
|
|
|
props: {
|
|
|
// 值
|
|
|
value: [String, Object, Array],
|
|
|
+ // 上传接口地址
|
|
|
+ action: {
|
|
|
+ type: String,
|
|
|
+ default: "/file/upload"
|
|
|
+ },
|
|
|
+ // 上传携带的参数
|
|
|
+ data: {
|
|
|
+ type: Object
|
|
|
+ },
|
|
|
// 数量限制
|
|
|
limit: {
|
|
|
type: Number,
|
|
@@ -78,7 +88,7 @@ export default {
|
|
|
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 @@ export default {
|
|
|
// 上传失败
|
|
|
handleUploadError(err) {
|
|
|
this.$modal.msgError("上传文件失败,请重试");
|
|
|
- this.$modal.closeLoading()
|
|
|
+ this.$modal.closeLoading();
|
|
|
},
|
|
|
// 上传成功回调
|
|
|
handleUploadSuccess(res, file) {
|