sadais-piui 1.2.7-beta187 → 1.2.7-beta188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: zhangzhenfei
|
|
3
|
-
* @Date: 2021-08-13 11:31:57
|
|
4
|
-
* @LastEditTime: 2025-04-18 16:28:01
|
|
5
|
-
* @LastEditors: zhangzhenfei
|
|
6
|
-
* @Description: 图片上传组件
|
|
7
|
-
* @FilePath: \piui\components\pi-upload-img\index.vue
|
|
8
|
-
-->
|
|
9
|
-
|
|
10
1
|
<template>
|
|
11
2
|
<view
|
|
12
3
|
class="pi-upload-img"
|
|
@@ -236,6 +227,13 @@ export default {
|
|
|
236
227
|
return uploadImg.imgField
|
|
237
228
|
}
|
|
238
229
|
},
|
|
230
|
+
// 文件预览名称字段,字符串形式(默认值:'name')
|
|
231
|
+
imgNameField: {
|
|
232
|
+
type: String,
|
|
233
|
+
default() {
|
|
234
|
+
return uploadImg.imgNameField
|
|
235
|
+
}
|
|
236
|
+
},
|
|
239
237
|
// 显示的图片模式
|
|
240
238
|
imageMode: {
|
|
241
239
|
type: String,
|
|
@@ -736,7 +734,10 @@ export default {
|
|
|
736
734
|
handlePreview(img) {
|
|
737
735
|
if (this.disablePreview) return
|
|
738
736
|
const file = this.imgField ? img[this.imgField] : img
|
|
739
|
-
const customFileName =
|
|
737
|
+
const customFileName =
|
|
738
|
+
(this.imgField && this.imgNameField ? img?.[this.imgNameField] : '') ||
|
|
739
|
+
(this.imgField ? img?.name : '') ||
|
|
740
|
+
(file ? file.substring(file.lastIndexOf('/') + 1) : '')
|
|
740
741
|
|
|
741
742
|
if (isImageFilename(file)) {
|
|
742
743
|
this.handlePreviewImage(file)
|
|
@@ -1158,10 +1159,6 @@ export default {
|
|
|
1158
1159
|
|
|
1159
1160
|
const tempFilePaths = compressTempFiles.length > 0 ? compressTempFiles : tempFiles
|
|
1160
1161
|
|
|
1161
|
-
console.log('this.getUploadMaxCount',this.getUploadMaxCount)
|
|
1162
|
-
console.log('this.crop',this.crop)
|
|
1163
|
-
console.log('tempFilePaths.length',tempFilePaths.length)
|
|
1164
|
-
|
|
1165
1162
|
if (
|
|
1166
1163
|
this.getUploadMaxCount === 1 &&
|
|
1167
1164
|
this.crop &&
|
package/config/uploadImg.js
CHANGED
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
customClass: '', // 自定义样式类,字符串形式('')
|
|
14
14
|
customStyle: {}, // 自定义样式,对象形式(默认值:{})
|
|
15
15
|
imgField: '', // 上传图片的字段名称,字符串形式(默认值:'')
|
|
16
|
+
imgNameField: 'name', // 文件预览名称字段,字符串形式(默认值:'name')
|
|
16
17
|
action: '', // 上传接口地址,字符串形式(默认值:'')
|
|
17
18
|
headers: {}, // 请求头,对象形式(默认值:{})
|
|
18
19
|
formData: {}, // 上传表单额外数据,对象形式(默认值:{})
|
package/package.json
CHANGED