|
|
@@ -5,6 +5,7 @@
|
|
5
|
5
|
:action="uploadFileUrl"
|
|
6
|
6
|
:before-upload="handleBeforeUpload"
|
|
7
|
7
|
:file-list="fileList"
|
|
|
8
|
+ :data="data"
|
|
8
|
9
|
:limit="limit"
|
|
9
|
10
|
:on-error="handleUploadError"
|
|
10
|
11
|
:on-exceed="handleExceed"
|
|
|
@@ -48,6 +49,15 @@ export default {
|
|
48
|
49
|
props: {
|
|
49
|
50
|
// 值
|
|
50
|
51
|
value: [String, Object, Array],
|
|
|
52
|
+ // 上传接口地址
|
|
|
53
|
+ action: {
|
|
|
54
|
+ type: String,
|
|
|
55
|
+ default: "/file/upload"
|
|
|
56
|
+ },
|
|
|
57
|
+ // 上传携带的参数
|
|
|
58
|
+ data: {
|
|
|
59
|
+ type: Object
|
|
|
60
|
+ },
|
|
51
|
61
|
// 数量限制
|
|
52
|
62
|
limit: {
|
|
53
|
63
|
type: Number,
|
|
|
@@ -78,7 +88,7 @@ export default {
|
|
78
|
88
|
return {
|
|
79
|
89
|
number: 0,
|
|
80
|
90
|
uploadList: [],
|
|
81
|
|
- uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传文件服务器地址
|
|
|
91
|
+ uploadFileUrl: process.env.VUE_APP_BASE_API + this.action, // 上传文件服务器地址
|
|
82
|
92
|
headers: {
|
|
83
|
93
|
Authorization: "Bearer " + getToken(),
|
|
84
|
94
|
},
|
|
|
@@ -152,7 +162,7 @@ export default {
|
|
152
|
162
|
// 上传失败
|
|
153
|
163
|
handleUploadError(err) {
|
|
154
|
164
|
this.$modal.msgError("上传文件失败,请重试");
|
|
155
|
|
- this.$modal.closeLoading()
|
|
|
165
|
+ this.$modal.closeLoading();
|
|
156
|
166
|
},
|
|
157
|
167
|
// 上传成功回调
|
|
158
|
168
|
handleUploadSuccess(res, file) {
|