sadais-piui 1.2.7-beta22 → 1.2.7-beta25

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.
@@ -56,8 +56,12 @@ export default {
56
56
  }
57
57
  },
58
58
  watch: {
59
- needInit() {
60
- this.init()
59
+ needInit: {
60
+ deep: true,
61
+ immediate: false,
62
+ handler(value) {
63
+ this.init()
64
+ }
61
65
  },
62
66
  // 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
63
67
  parentData() {
@@ -75,9 +79,11 @@ export default {
75
79
  methods: {
76
80
  // 重新初始化一次内部的所有子元素
77
81
  init() {
78
- this.children.map(child => {
79
- child.init()
80
- })
82
+ console.log('折叠面板初始化')
83
+ this.children &&
84
+ this.children.map(child => {
85
+ child.init()
86
+ })
81
87
  },
82
88
  /**
83
89
  * collapse-item被点击时触发,由collapse统一处理各子组件的状态
@@ -498,6 +498,7 @@ export default {
498
498
  .form-label {
499
499
  font-weight: $pi-form-label-weight;
500
500
  color: $pi-form-label-color;
501
+ white-space: nowrap;
501
502
  &.border {
502
503
  @include pi-border;
503
504
  &::after {
@@ -507,6 +508,7 @@ export default {
507
508
  }
508
509
  }
509
510
  .content-wrap {
511
+ overflow: hidden;
510
512
  &.nowrap {
511
513
  margin-left: 24rpx;
512
514
  }
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-steps" :style="[customStyle, { flexDirection: direction }]" :class="customClass">
2
+ <view
3
+ class="pi-steps pi-of-hidden"
4
+ :style="[customStyle, { flexDirection: direction }]"
5
+ :class="customClass"
6
+ >
3
7
  <view
4
8
  v-for="(item, index) in getItems"
5
9
  :key="index"
@@ -37,7 +41,13 @@
37
41
 
38
42
  <!-- 文字 -->
39
43
  <view :class="['pi-steps-item-text']" :style="{ color: item.style.fontColor }">
40
- <slot name="item" :item="item" :index="index" :active="index < val">
44
+ <slot
45
+ name="item"
46
+ :item="item"
47
+ :index="index"
48
+ :length="getItemsLength"
49
+ :active="index < val"
50
+ >
41
51
  <view>{{ item.name }}</view>
42
52
  <text v-if="item.desc" class="pi-fz-20 pi-mg-top-10" style="word-break:break-all">
43
53
  {{ item.desc }}
@@ -167,7 +177,7 @@ export default {
167
177
  },
168
178
  lineStyle() {
169
179
  const style = {}
170
- const size = this.getDotMaxSize / 2 + 'rpx'
180
+ const size = this.getDotMaxSize / 2 - 2 + 'rpx'
171
181
  this.direction === 'column' ? (style.left = size) : (style.top = size)
172
182
  return style
173
183
  },
@@ -240,18 +250,24 @@ export default {
240
250
  this.direction === 'column' &&
241
251
  this.itemsRect.length &&
242
252
  this.iconsRect.length &&
243
- index < this.itemsRect.length - 1
253
+ (this.itemsRect.length === 1 || index < this.itemsRect.length - 1) &&
254
+ (this.iconsRect.length === 1 || index < this.iconsRect.length - 1)
244
255
  ) {
245
256
  // 动态计算线的位置和高度
246
257
  item.lineStyle.top = `${this.iconsRect[index].top -
247
258
  this.itemsRect[index].top +
248
259
  this.iconsRect[index].height +
249
260
  2}px`
250
- item.lineStyle.height = `${this.itemsRect[index].height -
251
- this.iconsRect[index + 1].height}px`
261
+ const nextIconsRectHeight = this.iconsRect[index + 1]
262
+ ? this.iconsRect[index + 1].height
263
+ : 0
264
+ item.lineStyle.height = `${this.itemsRect[index].height - nextIconsRectHeight}px`
252
265
  }
253
266
  return item
254
267
  })
268
+ },
269
+ getItemsLength() {
270
+ return this.items.length
255
271
  }
256
272
  },
257
273
  watch: {
@@ -268,9 +284,16 @@ export default {
268
284
  },
269
285
  methods: {
270
286
  async init() {
287
+ if (!this.items?.length) return
271
288
  this.iconsRect = await this.$pi.common.queryRect(this, '.step-icon-inner', true)
272
289
  this.itemsRect = await this.$pi.common.queryRect(this, '.pi-steps-item', true)
273
- console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
290
+ if (this.iconsRect.length !== this.itemsRect.length) {
291
+ setTimeout(() => {
292
+ this.init()
293
+ }, 200)
294
+ } else {
295
+ console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
296
+ }
274
297
  }
275
298
  }
276
299
  }
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:31:57
4
- * @LastEditTime: 2022-04-12 09:11:41
4
+ * @LastEditTime: 2022-07-21 11:25:37
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传组件
7
- * @FilePath: \hfmp-checkin-frontc:\Users\feilin\workspace\sadais\piui-awesome\src\piui\components\pi-upload-img\index.vue
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
- return this.$pi.lang.mergeDeep(uploadImg.itemStyle, this.itemStyle)
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
- return this.$pi.lang.mergeDeep(uploadImg.uploadBtnStyle, this.uploadBtnStyle)
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)
@@ -1,10 +1,10 @@
1
1
  /*
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:29:02
4
- * @LastEditTime: 2021-11-17 10:07:54
4
+ * @LastEditTime: 2022-07-21 11:20:15
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传
7
- * @FilePath: /piui-awesome/src/piui/config/upload-img.js
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: '80', // 上传区域尺寸(半径)
28
+ size: '160', // 上传区域尺寸(半径)
33
29
  previewFullImage: true, // 是否在点击预览图后展示全屏图片预览
34
30
  deletable: true, // 是否可以删除上传的文件
35
31
  disabled: false, // 是否禁用上传
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta22",
3
+ "version": "1.2.7beta25",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {