sadais-piui 1.2.7-beta23 → 1.2.7-beta24
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,14 +1,14 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2021-08-13 11:31:57
|
|
4
|
-
* @LastEditTime: 2022-
|
|
4
|
+
* @LastEditTime: 2022-07-21 11:25:37
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 图片上传组件
|
|
7
|
-
* @FilePath:
|
|
7
|
+
* @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-upload-img/index.vue
|
|
8
8
|
-->
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
|
-
<view class="pi-upload-img" :style="[customStyle]" :class="[customClass]">
|
|
11
|
+
<view class="pi-upload-img pi-pd-top-12" :style="[customStyle]" :class="[customClass]">
|
|
12
12
|
<!-- 已上传图片展示 -->
|
|
13
13
|
<view
|
|
14
14
|
v-for="(img, index) in getImgs"
|
|
@@ -305,13 +305,29 @@ export default {
|
|
|
305
305
|
return this.$pi.lang.isString(this.val)
|
|
306
306
|
},
|
|
307
307
|
getImgs() {
|
|
308
|
+
if (this.val === null || this.val === undefined) {
|
|
309
|
+
return []
|
|
310
|
+
}
|
|
308
311
|
return this.isValString ? (this.val ? [this.val] : []) : this.val.filter(img => img)
|
|
309
312
|
},
|
|
310
313
|
getItemStyle() {
|
|
311
|
-
|
|
314
|
+
const style = {
|
|
315
|
+
width: this.getSize,
|
|
316
|
+
height: this.getSize
|
|
317
|
+
}
|
|
318
|
+
const uploadStyle = this.$pi.lang.mergeDeep(uploadImg.itemStyle, this.itemStyle)
|
|
319
|
+
return this.$pi.lang.mergeDeep(style, uploadStyle)
|
|
320
|
+
},
|
|
321
|
+
getSize() {
|
|
322
|
+
return this.$pi.common.addUnit(this.size)
|
|
312
323
|
},
|
|
313
324
|
getUploadBtnStyle() {
|
|
314
|
-
|
|
325
|
+
const style = {
|
|
326
|
+
width: this.getSize,
|
|
327
|
+
height: this.getSize
|
|
328
|
+
}
|
|
329
|
+
const uploadBtnStyle = this.$pi.lang.mergeDeep(uploadImg.uploadBtnStyle, this.uploadBtnStyle)
|
|
330
|
+
return this.$pi.lang.mergeDeep(style, uploadBtnStyle)
|
|
315
331
|
},
|
|
316
332
|
getUploadIcon() {
|
|
317
333
|
return this.$pi.lang.mergeDeep(uploadImg.uploadIcon, this.uploadIcon)
|
package/config/uploadImg.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2021-08-13 11:29:02
|
|
4
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditTime: 2022-07-21 11:20:15
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 图片上传
|
|
7
|
-
* @FilePath: /piui-awesome/src/piui/config/
|
|
7
|
+
* @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/config/uploadImg.js
|
|
8
8
|
*/
|
|
9
9
|
import icon from './icon.js'
|
|
10
10
|
import cropOption from './imgCropper.js'
|
|
@@ -18,18 +18,14 @@ export default {
|
|
|
18
18
|
formData: {}, // 上传表单额外数据,对象形式(默认值:{})
|
|
19
19
|
name: 'file', // 上传的文件字段名
|
|
20
20
|
itemStyle: {
|
|
21
|
-
width: '160rpx',
|
|
22
|
-
height: '160rpx',
|
|
23
21
|
borderRadius: '8rpx'
|
|
24
22
|
}, // 单个文件额外样式,对象形式(默认值:{})
|
|
25
23
|
uploadBtnStyle: {
|
|
26
|
-
width: '160rpx',
|
|
27
|
-
height: '160rpx',
|
|
28
24
|
background: '#f3f3f3',
|
|
29
25
|
borderRadius: '8rpx'
|
|
30
26
|
},
|
|
31
27
|
imageMode: 'aspectFill', // 上传图片模式,默认值:aspectFill
|
|
32
|
-
size: '
|
|
28
|
+
size: '160', // 上传区域尺寸(半径)
|
|
33
29
|
previewFullImage: true, // 是否在点击预览图后展示全屏图片预览
|
|
34
30
|
deletable: true, // 是否可以删除上传的文件
|
|
35
31
|
disabled: false, // 是否禁用上传
|