sadais-piui 1.2.7-beta127 → 1.2.7-beta129

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.
@@ -12,7 +12,12 @@
12
12
  :style="[computedLabelStyle, getLabelStyle]"
13
13
  :class="[{ border: getWrap && getLabelWrapBorder }]"
14
14
  >
15
- <view v-if="required" style="color: #ed2235;" class="pi-mg-right-12" :style="[requiredStyle]">
15
+ <view
16
+ v-if="required"
17
+ style="color: #ed2235;"
18
+ class="pi-mg-right-12"
19
+ :style="[requiredStyle]"
20
+ >
16
21
  *
17
22
  </view>
18
23
  <!-- 表单项label -->
@@ -28,7 +33,11 @@
28
33
  :class="[
29
34
  { 'pi-flex-sub': !getWrap },
30
35
  getInputAlign,
31
- { 'wrap': getWrap, 'nowrap': !getWrap, 'wrap-bottom': getWrap && getWrapBottomGap }
36
+ {
37
+ 'wrap': getWrap,
38
+ 'nowrap': !getWrap,
39
+ 'wrap-bottom': getWrap && getWrapBottomGap
40
+ }
32
41
  ]"
33
42
  :style="[contentWrapStyle]"
34
43
  >
@@ -41,7 +50,11 @@
41
50
  <slot />
42
51
  </view>
43
52
  <view
44
- v-if="getErrorType === 'message' && validateState === 'error' && validateMessage"
53
+ v-if="
54
+ getErrorType === 'message' &&
55
+ validateState === 'error' &&
56
+ validateMessage
57
+ "
45
58
  class="form-valid"
46
59
  >
47
60
  <view class="form-valid-item">{{ validateMessage }}</view>
@@ -262,6 +275,7 @@ export default {
262
275
  },
263
276
  data() {
264
277
  return {
278
+ componentDestroy: false,
265
279
  initialValue: '', // 初始值
266
280
  validateState: 'success', // 是否校验成功
267
281
  validateMessage: '' // 校验失败的提示语
@@ -269,10 +283,16 @@ export default {
269
283
  },
270
284
  computed: {
271
285
  getShowRightIcon() {
272
- return this.$pi.expand.getPropValue(this.inheritProps.showRightIcon, this.showRightIcon)
286
+ return this.$pi.expand.getPropValue(
287
+ this.inheritProps.showRightIcon,
288
+ this.showRightIcon
289
+ )
273
290
  },
274
291
  getRightIcon() {
275
- const rightIcon = this.$pi.lang.mergeDeep(this.inheritProps.rightIcon, this.rightIcon)
292
+ const rightIcon = this.$pi.lang.mergeDeep(
293
+ this.inheritProps.rightIcon,
294
+ this.rightIcon
295
+ )
276
296
  return this.$pi.lang.mergeDeep(formItem.rightIcon, rightIcon)
277
297
  },
278
298
  getBorder() {
@@ -282,7 +302,10 @@ export default {
282
302
  return this.$pi.expand.getPropValue(this.inheritProps.wrap, this.wrap)
283
303
  },
284
304
  getWrapBottomGap() {
285
- return this.$pi.expand.getPropValue(this.inheritProps.wrapBottomGap, this.wrapBottomGap)
305
+ return this.$pi.expand.getPropValue(
306
+ this.inheritProps.wrapBottomGap,
307
+ this.wrapBottomGap
308
+ )
286
309
  },
287
310
  getLabelWrapBorder() {
288
311
  return this.inheritProps.labelWrapBorder !== null
@@ -293,23 +316,38 @@ export default {
293
316
  return this.$pi.expand.getPropValue(this.inheritProps.colon, this.colon)
294
317
  },
295
318
  getDisabled() {
296
- return this.$pi.expand.getPropValue(this.inheritProps.disabled, this.disabled)
319
+ return this.$pi.expand.getPropValue(
320
+ this.inheritProps.disabled,
321
+ this.disabled
322
+ )
297
323
  },
298
324
  getLabelAlign() {
299
- return this.$pi.expand.getPropValue(this.inheritProps.labelAlign, this.labelAlign)
325
+ return this.$pi.expand.getPropValue(
326
+ this.inheritProps.labelAlign,
327
+ this.labelAlign
328
+ )
300
329
  },
301
330
  getInputAlign() {
302
- return this.$pi.expand.getPropValue(this.inheritProps.inputAlign, this.inputAlign)
331
+ return this.$pi.expand.getPropValue(
332
+ this.inheritProps.inputAlign,
333
+ this.inputAlign
334
+ )
303
335
  },
304
336
  getErrorType() {
305
337
  return this.inheritProps.errorType
306
338
  },
307
339
  getPadding() {
308
- const padding = this.$pi.expand.getPropValue(this.inheritProps.padding, this.padding)
340
+ const padding = this.$pi.expand.getPropValue(
341
+ this.inheritProps.padding,
342
+ this.padding
343
+ )
309
344
  return this.$pi.common.addUnit(padding)
310
345
  },
311
346
  getHeight() {
312
- const height = this.$pi.expand.getPropValue(this.inheritProps.height, this.height)
347
+ const height = this.$pi.expand.getPropValue(
348
+ this.inheritProps.height,
349
+ this.height
350
+ )
313
351
  return this.$pi.common.addUnit(height)
314
352
  },
315
353
  itemStyle() {
@@ -320,7 +358,10 @@ export default {
320
358
  return style
321
359
  },
322
360
  getLabelStyle() {
323
- return this.$pi.expand.getPropValue(this.inheritProps.labelStyle, this.labelStyle)
361
+ return this.$pi.expand.getPropValue(
362
+ this.inheritProps.labelStyle,
363
+ this.labelStyle
364
+ )
324
365
  },
325
366
  getItemVerticalAlign() {
326
367
  return this.$pi.expand.getPropValue(
@@ -374,6 +415,12 @@ export default {
374
415
  mounted() {
375
416
  this.initRulesValidation()
376
417
  },
418
+ created() {
419
+ this.componentDestroy = false
420
+ },
421
+ beforeDestroy() {
422
+ this.componentDestroy = true
423
+ },
377
424
  methods: {
378
425
  handleItemClick(e) {
379
426
  this.$emit('click', e)
@@ -409,14 +456,16 @@ export default {
409
456
  let rules = this.getRules()
410
457
  // 整体验证表单时,triggerType为空字符串
411
458
  if (!triggerType) return rules
412
- return rules.filter(res => res.trigger && res.trigger.indexOf(triggerType) !== -1)
459
+ return rules.filter(
460
+ res => res.trigger && res.trigger.indexOf(triggerType) !== -1
461
+ )
413
462
  },
414
463
  getFieldValue(obj, keypath) {
415
464
  if (obj) {
416
465
  return keypath.split('-').reduce((prev, key) => {
417
466
  let tmpKey = key
418
467
  if (/^\[\d+\]$/.test(key)) {
419
- tmpKey = tmpKey.slice(1, -1)
468
+ tmpKey = tmpKey.slice(1, -1)
420
469
  }
421
470
  prev = prev && prev[tmpKey]
422
471
  return prev
@@ -435,13 +484,20 @@ export default {
435
484
  }
436
485
  return new Promise((resolve, reject) => {
437
486
  const rules = this.getFilteredRule(trigger)
438
- if (!this.prop || !rules || rules.length === 0) {
487
+ if (
488
+ this.componentDestroy ||
489
+ !this.prop ||
490
+ !rules ||
491
+ rules.length === 0
492
+ ) {
439
493
  this.validateState = 'success'
440
494
  this.validateMessage = ''
441
495
  console.log(TAG, '字段无需校验', this.prop)
442
496
  return resolve(_getResolve())
443
497
  }
444
- const fieldValue = this._parent ? this.getFieldValue(this._parent.model, this.prop) : undefined
498
+ const fieldValue = this._parent
499
+ ? this.getFieldValue(this._parent.model, this.prop)
500
+ : undefined
445
501
  // 设置当前的装填,标识为校验中
446
502
  this.validateState = 'validating'
447
503
  // 调用async-validator的方法
@@ -465,7 +521,12 @@ export default {
465
521
  resolve(_getResolve())
466
522
  })
467
523
  .catch(({ errors, fields }) => {
468
- console.log(TAG, '表单校验失败', `字段名:${this.prop},字段值:${fieldValue}`)
524
+ console.log('thisthisthis', this)
525
+ console.log(
526
+ TAG,
527
+ '表单校验失败',
528
+ `字段名:${this.prop},字段值:${fieldValue}`
529
+ )
469
530
  console.log(TAG, '字段值:', fieldValue)
470
531
  console.log(TAG, '错误信息', errors)
471
532
  console.log(TAG, '校验规则', fields)
@@ -13,7 +13,7 @@
13
13
  :previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'"
14
14
  :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'"
15
15
  :style="[swiperStyle]"
16
- @change="handleSwiperChange"
16
+ @animationfinish="handleSwiperChange"
17
17
  >
18
18
  <swiper-item
19
19
  v-for="(img, index) in imgs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta127",
3
+ "version": "1.2.7-beta129",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {