sadais-piui 1.2.7-beta152 → 1.2.7-beta154

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.
Files changed (59) hide show
  1. package/components/pi-badge/index.vue +8 -2
  2. package/components/pi-bottom-bar/index.vue +14 -3
  3. package/components/pi-bubble/index.vue +14 -3
  4. package/components/pi-button/index.vue +16 -3
  5. package/components/pi-calendar-input/index.vue +15 -5
  6. package/components/pi-calendar-panel/components/calendar-days/index.vue +7 -2
  7. package/components/pi-calendar-panel/index.vue +22 -7
  8. package/components/pi-canvas/index.vue +11 -2
  9. package/components/pi-card/index.vue +5 -1
  10. package/components/pi-cascader/index.vue +49 -15
  11. package/components/pi-circle-progress/index.vue +30 -5
  12. package/components/pi-code-input/index.vue +3 -2
  13. package/components/pi-collapse/index.vue +2 -1
  14. package/components/pi-count-up/index.vue +8 -2
  15. package/components/pi-date-picker-input/index.vue +15 -5
  16. package/components/pi-divider/index.vue +5 -1
  17. package/components/pi-dropdown/components/dropdown-tab.vue +6 -1
  18. package/components/pi-dropdown/index.vue +16 -4
  19. package/components/pi-dropdown-item/index.vue +13 -5
  20. package/components/pi-form/index.vue +8 -2
  21. package/components/pi-grid/index.vue +5 -1
  22. package/components/pi-grid-item/index.vue +13 -4
  23. package/components/pi-icon/index.vue +6 -1
  24. package/components/pi-img-cropper/canvas.js +10 -3
  25. package/components/pi-img-cropper/touch.js +4 -1
  26. package/components/pi-img-cropper/vector.js +2 -2
  27. package/components/pi-line-progress/index.vue +9 -2
  28. package/components/pi-list/index.vue +5 -1
  29. package/components/pi-list-item/index.vue +8 -3
  30. package/components/pi-loading/index.vue +10 -2
  31. package/components/pi-navbar/index.vue +22 -5
  32. package/components/pi-notify/index.vue +9 -3
  33. package/components/pi-number-keyboard/index.vue +15 -3
  34. package/components/pi-opentype-button/index.vue +11 -3
  35. package/components/pi-pagination/index.vue +5 -1
  36. package/components/pi-popup/index.vue +8 -4
  37. package/components/pi-radio-group/index.vue +3 -1
  38. package/components/pi-rate/index.vue +9 -2
  39. package/components/pi-regions-select/index.vue +45 -12
  40. package/components/pi-section/index.vue +5 -1
  41. package/components/pi-skeleton/index.vue +2 -1
  42. package/components/pi-status-bar/index.vue +4 -1
  43. package/components/pi-stepper/index.vue +118 -118
  44. package/components/pi-steps/index.vue +21 -5
  45. package/components/pi-subsection/index.vue +10 -5
  46. package/components/pi-switch/index.vue +14 -5
  47. package/components/pi-table/index.vue +61 -61
  48. package/components/pi-tabs/index.vue +45 -14
  49. package/components/pi-tag/index.vue +17 -5
  50. package/components/pi-upload-img/index.vue +50 -101
  51. package/components/pi-waterfall/index.vue +14 -5
  52. package/config/circleProgress.js +25 -5
  53. package/config/marqueePureCss.js +1 -1
  54. package/config/table.js +1 -1
  55. package/config/uploadImg.js +21 -0
  56. package/index.js +15 -2
  57. package/mixin/page-transitions/index.js +7 -2
  58. package/package.json +1 -1
  59. package/utils/file-utils.js +222 -0
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-dropdown pi-rela pi-w-100P" :class="[customClass]" :style="[customStyle]">
2
+ <view
3
+ class="pi-dropdown pi-rela pi-w-100P"
4
+ :class="[customClass]"
5
+ :style="[customStyle]"
6
+ >
3
7
  <view>
4
8
  <pi-tabs
5
9
  :value="activeItem"
@@ -37,7 +41,9 @@
37
41
  :style="[
38
42
  {
39
43
  'z-index': getMask.zIndex,
40
- 'top': maskAlignTop ? containerRect.top + containerRect.height + 'px' : '-9999px',
44
+ 'top': maskAlignTop
45
+ ? containerRect.top + containerRect.height + 'px'
46
+ : '-9999px',
41
47
  'background': getMask.background,
42
48
  'animation-duration': getDuration.css
43
49
  }
@@ -263,7 +269,9 @@ export default {
263
269
  showIcon: item.showIcon,
264
270
  iconOption: item.getIconOption,
265
271
  id: item._uid,
266
- text: currentOption ? currentOption[item.getDisplayField] : item.title,
272
+ text: currentOption
273
+ ? currentOption[item.getDisplayField]
274
+ : item.title,
267
275
  disabled: item.disabled,
268
276
  opened: false,
269
277
  activeColor: this.activeColor
@@ -290,7 +298,11 @@ export default {
290
298
  })
291
299
  this.activeItem = item
292
300
  // 每次点击都重新更新父容器的位置
293
- this.containerRect = await this.$pi.common.queryRect(this, '.pi-dropdown', false)
301
+ this.containerRect = await this.$pi.common.queryRect(
302
+ this,
303
+ '.pi-dropdown',
304
+ false
305
+ )
294
306
  this.openMask()
295
307
  this._children.forEach(child => {
296
308
  child.show = child._uid === item.id
@@ -11,7 +11,9 @@
11
11
  :class="[
12
12
  customClass,
13
13
  item[getDisabledField] ? 'disabled' : '',
14
- getSelectedCheckbox === 'none' ? 'pi-justify-center' : 'pi-justify-between'
14
+ getSelectedCheckbox === 'none'
15
+ ? 'pi-justify-center'
16
+ : 'pi-justify-between'
15
17
  ]"
16
18
  :style="[customStyle, getItemStyle]"
17
19
  @tap="handleSelectItem(item)"
@@ -173,10 +175,14 @@ export default {
173
175
  return this.$pi.lang.mergeDeep(dropdownItem.iconOption, this.iconOption)
174
176
  },
175
177
  getItemHeight() {
176
- return this.inheritProps.itemHeight !== null ? this.inheritProps.itemHeight : this.itemHeight
178
+ return this.inheritProps.itemHeight !== null
179
+ ? this.inheritProps.itemHeight
180
+ : this.itemHeight
177
181
  },
178
182
  getKeyField() {
179
- return this.inheritProps.keyField !== null ? this.inheritProps.keyField : this.keyField
183
+ return this.inheritProps.keyField !== null
184
+ ? this.inheritProps.keyField
185
+ : this.keyField
180
186
  },
181
187
  getDisplayField() {
182
188
  return this.inheritProps.displayField !== null
@@ -189,14 +195,16 @@ export default {
189
195
  : this.disabledField
190
196
  },
191
197
  getSelectedImg() {
192
- const selectedImg = this.inheritProps.selectedImg || dropdownItem.selectedImg
198
+ const selectedImg =
199
+ this.inheritProps.selectedImg || dropdownItem.selectedImg
193
200
  return this.$pi.lang.mergeDeep(selectedImg, this.selectedImg)
194
201
  },
195
202
  getSelectedCheckbox() {
196
203
  if (this.inheritProps.selectedCheckbox === 'none') {
197
204
  return this.inheritProps.selectedCheckbox
198
205
  }
199
- const selectedCheckbox = this.inheritProps.selectedCheckbox || dropdownItem.selectedCheckbox
206
+ const selectedCheckbox =
207
+ this.inheritProps.selectedCheckbox || dropdownItem.selectedCheckbox
200
208
  return this.$pi.lang.mergeDeep(selectedCheckbox, this.selectedCheckbox)
201
209
  },
202
210
  getItemStyle() {
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-form" :style="[customStyle]" :class="[{ border }, customClass]">
2
+ <view
3
+ class="pi-form"
4
+ :style="[customStyle]"
5
+ :class="[{ border }, customClass]"
6
+ >
3
7
  <pi-section
4
8
  v-if="title"
5
9
  :title="title"
@@ -250,7 +254,9 @@ export default {
250
254
  async validation() {
251
255
  const validations = this._children.map(c => c.validation())
252
256
  const results = await Promise.all(validations)
253
- const failedResults = results.filter(result => result.validateState === 'error')
257
+ const failedResults = results.filter(
258
+ result => result.validateState === 'error'
259
+ )
254
260
  if (this.errorType === 'toast' && failedResults.length > 0) {
255
261
  this.$toast(failedResults[0].validateMessage)
256
262
  }
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-grid" :style="[customStyle]" :class="[{ border: showBorder }, customClass]">
2
+ <view
3
+ class="pi-grid"
4
+ :style="[customStyle]"
5
+ :class="[{ border: showBorder }, customClass]"
6
+ >
3
7
  <slot />
4
8
  </view>
5
9
  </template>
@@ -121,13 +121,19 @@ export default {
121
121
  return `calc((100% - ${this.getRowGapWidth}) / ${this.getCol})`
122
122
  },
123
123
  getSquare() {
124
- return this.inheritProps.square !== null ? this.inheritProps.square : this.square
124
+ return this.inheritProps.square !== null
125
+ ? this.inheritProps.square
126
+ : this.square
125
127
  },
126
128
  getBorder() {
127
- return this.inheritProps.border !== null ? this.inheritProps.border : this.border
129
+ return this.inheritProps.border !== null
130
+ ? this.inheritProps.border
131
+ : this.border
128
132
  },
129
133
  getHoverClass() {
130
- return this.inheritProps.hoverClass !== null ? this.inheritProps.hoverClass : this.hoverClass
134
+ return this.inheritProps.hoverClass !== null
135
+ ? this.inheritProps.hoverClass
136
+ : this.hoverClass
131
137
  },
132
138
  isLastCol() {
133
139
  // 是否是最后一列
@@ -173,7 +179,10 @@ export default {
173
179
  methods: {
174
180
  valid() {
175
181
  if (this.getGap && this.index === null) {
176
- console.warn(TAG, '当设置gap的时候,请把当前迭代器的索引传递到index属性,否则宽度计算有误')
182
+ console.warn(
183
+ TAG,
184
+ '当设置gap的时候,请把当前迭代器的索引传递到index属性,否则宽度计算有误'
185
+ )
177
186
  }
178
187
  },
179
188
  handleItemClick(e) {
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <view class="icon-wrap" @tap="handleClick">
3
3
  <view :style="[iconStyle, customStyle]" :class="[iconClass, customClass]" />
4
- <view v-if="badge || dot" class="icon-badge" :class="{ dot }" :style="[badgeStyle]">
4
+ <view
5
+ v-if="badge || dot"
6
+ class="icon-badge"
7
+ :class="{ dot }"
8
+ :style="[badgeStyle]"
9
+ >
5
10
  {{ badge }}
6
11
  </view>
7
12
  </view>
@@ -53,11 +53,18 @@ export default {
53
53
  width: this.crop.width,
54
54
  height: this.crop.height
55
55
  })
56
- ctx.fillRect(0, 0, this.crop.width * this.canvasZoom, this.crop.height * this.canvasZoom)
56
+ ctx.fillRect(
57
+ 0,
58
+ 0,
59
+ this.crop.width * this.canvasZoom,
60
+ this.crop.height * this.canvasZoom
61
+ )
57
62
  // 将画布的坐标原点 移动到裁剪窗口左上角对应的那个像素点的位置
58
63
  ctx.translate(
59
- (this.img.width * 0.5 + this.img.transform.x - this.crop.left) * this.canvasZoom,
60
- (this.img.height * 0.5 + this.img.transform.y - this.crop.top) * this.canvasZoom
64
+ (this.img.width * 0.5 + this.img.transform.x - this.crop.left) *
65
+ this.canvasZoom,
66
+ (this.img.height * 0.5 + this.img.transform.y - this.crop.top) *
67
+ this.canvasZoom
61
68
  )
62
69
  // 旋转图片
63
70
  ctx.rotate((this.img.transform.rotate * Math.PI) / 180)
@@ -44,7 +44,10 @@ export default {
44
44
  const curVector = { x: p.pageX - touch.pageX, y: p.pageY - touch.pageY }
45
45
  if (this.touch.prevVector) {
46
46
  if (!this.disableRotate) {
47
- this.img.transform.rotate += this.angle(this.touch.prevVector, curVector)
47
+ this.img.transform.rotate += this.angle(
48
+ this.touch.prevVector,
49
+ curVector
50
+ )
48
51
  }
49
52
  const zoom = this.mod(curVector) / this.mod(this.touch.prevVector)
50
53
  this.img.transform.scale *= zoom
@@ -19,7 +19,7 @@ export default {
19
19
  let angle = Math.acos(cosValue)
20
20
  const tmp = vector1.x * vector2.y - vector1.y * vector2.x
21
21
  angle = tmp > 0 ? angle : -angle
22
- return angle * 180 / Math.PI
22
+ return (angle * 180) / Math.PI
23
23
  }
24
24
  return 0
25
25
  },
@@ -32,4 +32,4 @@ export default {
32
32
  return Math.sqrt(vector.x * vector.x + vector.y * vector.y)
33
33
  }
34
34
  }
35
- }
35
+ }
@@ -6,10 +6,17 @@
6
6
  >
7
7
  <view
8
8
  class="active-bar"
9
- :class="[{ round: round }, { striped: striped }, { active: stripedActive }]"
9
+ :class="[
10
+ { round: round },
11
+ { striped: striped },
12
+ { active: stripedActive }
13
+ ]"
10
14
  :style="[activeBarStyle]"
11
15
  >
12
- <view class="percent" :style="[{ height: getHeight, lineHeight: getHeight }, percentStyle]">
16
+ <view
17
+ class="percent"
18
+ :style="[{ height: getHeight, lineHeight: getHeight }, percentStyle]"
19
+ >
13
20
  <slot v-if="$slots.default || $slots.$default" />
14
21
  <template v-else-if="showPercent">
15
22
  {{ percent + '%' }}
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-list" :style="[customStyle]" :class="[{ border: showBorder }, customClass]">
2
+ <view
3
+ class="pi-list"
4
+ :style="[customStyle]"
5
+ :class="[{ border: showBorder }, customClass]"
6
+ >
3
7
  <pi-section
4
8
  v-if="title"
5
9
  :title="title"
@@ -23,8 +23,12 @@
23
23
 
24
24
  <!-- 标题和描述 -->
25
25
  <view v-if="title || desc" class="title-wrap">
26
- <view v-if="title" :style="[titleStyle]" class="list-item-title">{{ title }}</view>
27
- <view v-if="desc" :style="[descStyle]" class="list-item-desc">{{ desc }}</view>
26
+ <view v-if="title" :style="[titleStyle]" class="list-item-title">{{
27
+ title
28
+ }}</view>
29
+ <view v-if="desc" :style="[descStyle]" class="list-item-desc">{{
30
+ desc
31
+ }}</view>
28
32
  </view>
29
33
  <!-- 中间区域 -->
30
34
  <view class="pi-flex-sub pi-w-100P pi-of-hidden">
@@ -234,7 +238,8 @@ export default {
234
238
  return this.$pi.common.addUnit(height)
235
239
  },
236
240
  getShowRightIcon() {
237
- return !this.isEmptyInheritProps && this.inheritProps.showRightIcon !== null
241
+ return !this.isEmptyInheritProps &&
242
+ this.inheritProps.showRightIcon !== null
238
243
  ? this.inheritProps.showRightIcon
239
244
  : this.showRightIcon
240
245
  },
@@ -5,8 +5,16 @@
5
5
  :style="[customStyle, loadingStyle]"
6
6
  :class="[customClass, vertical ? 'vertical' : '']"
7
7
  >
8
- <view v-if="type === 'round'" class="loading-round" :style="[cricleStyle]" />
9
- <view v-if="type === 'spinner'" class="loading-spinner" :style="[cricleStyle]">
8
+ <view
9
+ v-if="type === 'round'"
10
+ class="loading-round"
11
+ :style="[cricleStyle]"
12
+ />
13
+ <view
14
+ v-if="type === 'spinner'"
15
+ class="loading-spinner"
16
+ :style="[cricleStyle]"
17
+ >
10
18
  <view v-for="line of 12" :key="line" />
11
19
  </view>
12
20
  <view
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="navbar-wrap" :style="[{ zIndex }, customStyle]" :class="[customClass]">
2
+ <view
3
+ class="navbar-wrap"
4
+ :style="[{ zIndex }, customStyle]"
5
+ :class="[customClass]"
6
+ >
3
7
  <!-- 当导航栏为fixed时候,占位用 -->
4
8
  <view
5
9
  v-if="fixed && placeholder"
@@ -13,7 +17,10 @@
13
17
  <!-- 内部状态栏占位用 -->
14
18
  <pi-status-bar v-if="placeholder" :background="statusBarBackground" />
15
19
  <!-- 真正渲染的navbar -->
16
- <view class="pi-navbar pi-rela pi-w-100P pi-align-center" :style="[{ background, height }]">
20
+ <view
21
+ class="pi-navbar pi-rela pi-w-100P pi-align-center"
22
+ :style="[{ background, height }]"
23
+ >
17
24
  <!-- 左侧 -->
18
25
  <view
19
26
  class="pi-align-center nav-icon"
@@ -26,11 +33,19 @@
26
33
  >
27
34
  <!-- 定制导航栏左侧内容 -->
28
35
  <slot name="left" />
29
- <view v-if="isShowBack" class="pi-align-center back-wrap" @tap.stop="handleGoBack">
36
+ <view
37
+ v-if="isShowBack"
38
+ class="pi-align-center back-wrap"
39
+ @tap.stop="handleGoBack"
40
+ >
30
41
  <view :class="'pi-icon-' + backIconName" :style="[backIconStyle]" />
31
42
  <view v-if="backText" :style="[backTextStyle]">{{ backText }}</view>
32
43
  </view>
33
- <view v-if="showHome" class="pi-align-center home-wrap" @tap.stop="handleGoHome">
44
+ <view
45
+ v-if="showHome"
46
+ class="pi-align-center home-wrap"
47
+ @tap.stop="handleGoHome"
48
+ >
34
49
  <view
35
50
  :class="'pi-icon-' + homeIconName"
36
51
  :style="[
@@ -286,7 +301,9 @@ export default {
286
301
  // 状态栏高度
287
302
  statusBarHeight() {
288
303
  const statusBarHeight =
289
- systemInfo && systemInfo.statusBarHeight ? systemInfo.statusBarHeight : 0
304
+ systemInfo && systemInfo.statusBarHeight
305
+ ? systemInfo.statusBarHeight
306
+ : 0
290
307
  return `${statusBarHeight}px`
291
308
  },
292
309
  navTitleStyle() {
@@ -65,9 +65,15 @@ export default {
65
65
  // 'primary'
66
66
  default: notify.type,
67
67
  validator: function(value) {
68
- return ['primary', 'success', 'danger', 'warning', 'info', 'customDuration', ''].includes(
69
- value
70
- )
68
+ return [
69
+ 'primary',
70
+ 'success',
71
+ 'danger',
72
+ 'warning',
73
+ 'info',
74
+ 'customDuration',
75
+ ''
76
+ ].includes(value)
71
77
  }
72
78
  },
73
79
  // 展示时长,默认单位 ms
@@ -17,10 +17,19 @@
17
17
  <view
18
18
  class="pi-pd-bottom-32"
19
19
  :style="[{ backgroundColor: backgroundColor }, customStyle]"
20
- :class="[getPopupSelect.showTitle ? 'pi-pd-top-12' : 'pi-pd-top-60', customClass]"
20
+ :class="[
21
+ getPopupSelect.showTitle ? 'pi-pd-top-12' : 'pi-pd-top-60',
22
+ customClass
23
+ ]"
21
24
  >
22
25
  <!-- 选择区域 -->
23
- <pi-grid col="3" gap="24" :border="false" hover-class="none" custom-class="pi-pd-lr-24">
26
+ <pi-grid
27
+ col="3"
28
+ gap="24"
29
+ :border="false"
30
+ hover-class="none"
31
+ custom-class="pi-pd-lr-24"
32
+ >
24
33
  <!-- 固定生成12个坑位 -->
25
34
  <pi-grid-item
26
35
  v-for="(key, index) in $pi.common.generateArray(0, 11)"
@@ -128,7 +137,10 @@ export default {
128
137
  },
129
138
  computed: {
130
139
  getPopupSelect() {
131
- return this.$pi.lang.mergeDeep(numberKeyboard.popupSelect, this.popupSelect)
140
+ return this.$pi.lang.mergeDeep(
141
+ numberKeyboard.popupSelect,
142
+ this.popupSelect
143
+ )
132
144
  },
133
145
  getPopup() {
134
146
  const numberKeyboardPopup = this.$pi.lang.mergeDeep(
@@ -31,7 +31,11 @@
31
31
  <!-- 按钮内容 -->
32
32
  <slot />
33
33
  <view v-if="ripple" class="pi-abso-full pi-of-hidden" :class="[{ round }]">
34
- <view class="wave-ripple" :class="[{ active: waveInfo.active }]" :style="[waveStyle]" />
34
+ <view
35
+ class="wave-ripple"
36
+ :class="[{ active: waveInfo.active }]"
37
+ :style="[waveStyle]"
38
+ />
35
39
  </view>
36
40
  </button>
37
41
  </template>
@@ -57,7 +61,9 @@ export default {
57
61
  // 'default'
58
62
  default: button.size,
59
63
  validator: function(value) {
60
- return ['default', 'large', 'medium', 'small', 'tiny', 'mini'].includes(value)
64
+ return ['default', 'large', 'medium', 'small', 'tiny', 'mini'].includes(
65
+ value
66
+ )
61
67
  }
62
68
  },
63
69
  // 按钮的预置样式
@@ -67,7 +73,9 @@ export default {
67
73
  // 'default'
68
74
  default: button.type,
69
75
  validator: function(value) {
70
- return ['default', 'primary', 'warn', 'secondary', 'line'].includes(value)
76
+ return ['default', 'primary', 'warn', 'secondary', 'line'].includes(
77
+ value
78
+ )
71
79
  }
72
80
  },
73
81
  // 按钮是否镂空
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="page-wrap" :class="customClass" :style="[customStyle, { textAlign: align }]">
2
+ <view
3
+ class="page-wrap"
4
+ :class="customClass"
5
+ :style="[customStyle, { textAlign: align }]"
6
+ >
3
7
  <view
4
8
  class="prev"
5
9
  :class="{ active: val > 1 }"
@@ -22,7 +22,8 @@
22
22
  customClass,
23
23
  aniClass,
24
24
  {
25
- 'pi-safearea': !['top', 'center'].includes(position) && safeAreaInsetBottom
25
+ 'pi-safearea':
26
+ !['top', 'center'].includes(position) && safeAreaInsetBottom
26
27
  }
27
28
  ]"
28
29
  :style="[
@@ -213,7 +214,8 @@ export default {
213
214
  right: 'tl', // 左上角
214
215
  center: 'tr' // 右上角
215
216
  }
216
- const closePosition = this.getCloseIcon.position || closePositionMap[this.position]
217
+ const closePosition =
218
+ this.getCloseIcon.position || closePositionMap[this.position]
217
219
  return closePosition
218
220
  },
219
221
  closeIconStyle() {
@@ -323,11 +325,13 @@ export default {
323
325
  @import '../../scss/mixin.scss';
324
326
 
325
327
  .ani-scale-center-up {
326
- animation: scale-center-up $pi-animation-duration $pi-animation-timing-function both;
328
+ animation: scale-center-up $pi-animation-duration
329
+ $pi-animation-timing-function both;
327
330
  }
328
331
 
329
332
  .ani-scale-center-down {
330
- animation: scale-center-down $pi-animation-duration $pi-animation-timing-function both;
333
+ animation: scale-center-down $pi-animation-duration
334
+ $pi-animation-timing-function both;
331
335
  }
332
336
 
333
337
  @keyframes scale-center-up {
@@ -146,7 +146,9 @@ export default {
146
146
  // 'line'
147
147
  default: radioGroup.activeMode,
148
148
  validator: function(value) {
149
- return ['', 'line', 'line-circle', 'fill', 'fill-circle'].includes(value)
149
+ return ['', 'line', 'line-circle', 'fill', 'fill-circle'].includes(
150
+ value
151
+ )
150
152
  }
151
153
  },
152
154
  // 能否取消选中状态
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <view class="pi-rate pi-align-center" @touchmove.stop.prevent="handleTouchMove">
2
+ <view
3
+ class="pi-rate pi-align-center"
4
+ @touchmove.stop.prevent="handleTouchMove"
5
+ >
3
6
  <view v-for="(item, index) in count" :key="index" class="rate-icon">
4
7
  <pi-icon
5
8
  :name="val > index ? selectedIcon : unselectedIcon"
@@ -161,7 +164,11 @@ export default {
161
164
  },
162
165
  methods: {
163
166
  async init() {
164
- const srollWrapRect = await this.$pi.common.queryRect(this, '.pi-rate', false)
167
+ const srollWrapRect = await this.$pi.common.queryRect(
168
+ this,
169
+ '.pi-rate',
170
+ false
171
+ )
165
172
  if (srollWrapRect) {
166
173
  this.containerLeft = srollWrapRect.left
167
174
  }
@@ -20,10 +20,18 @@
20
20
  @show="$emit('show', $event)"
21
21
  @showed="$emit('showed', $event)"
22
22
  >
23
- <view class="pi-h-100P pi-flex-column" :style="[customStyle]" :class="[customClass]">
23
+ <view
24
+ class="pi-h-100P pi-flex-column"
25
+ :style="[customStyle]"
26
+ :class="[customClass]"
27
+ >
24
28
  <slot name="header" />
25
29
  <pi-tabs v-if="val" v-model="tabCurrentItem" :items="getTabItems" />
26
- <swiper class="pi-scroll" :current="tabCurrent" @change="handleSwiperChange">
30
+ <swiper
31
+ class="pi-scroll"
32
+ :current="tabCurrent"
33
+ @change="handleSwiperChange"
34
+ >
27
35
  <swiper-item v-for="item in getTabItems" :key="item.id">
28
36
  <!-- 选择区域 -->
29
37
  <scroll-view class="pi-h-100P" scroll-y scroll-with-animation>
@@ -180,14 +188,20 @@ export default {
180
188
  },
181
189
  computed: {
182
190
  getPopupSelect() {
183
- return this.$pi.lang.mergeDeep(regionsSelect.popupSelect, this.popupSelect)
191
+ return this.$pi.lang.mergeDeep(
192
+ regionsSelect.popupSelect,
193
+ this.popupSelect
194
+ )
184
195
  },
185
196
  getConfirmBtn() {
186
197
  const regionsSelectConfirmBtn = this.$pi.lang.mergeDeep(
187
198
  regionsSelect.confirmBtn,
188
199
  this.popupSelect.confirmBtn
189
200
  )
190
- const mergeConfirmBtn = this.$pi.lang.mergeDeep(regionsSelectConfirmBtn, this.confirmBtn)
201
+ const mergeConfirmBtn = this.$pi.lang.mergeDeep(
202
+ regionsSelectConfirmBtn,
203
+ this.confirmBtn
204
+ )
191
205
  mergeConfirmBtn.disabled = !this.isCompleted
192
206
  return mergeConfirmBtn
193
207
  },
@@ -226,7 +240,9 @@ export default {
226
240
  },
227
241
  getTabItems() {
228
242
  const { province, city, county } = this.regions
229
- const tabs = [{ id: 'province', text: province.name || PLEASE_SELECT_TIP }]
243
+ const tabs = [
244
+ { id: 'province', text: province.name || PLEASE_SELECT_TIP }
245
+ ]
230
246
  if (province.name) {
231
247
  tabs.push({ id: 'city', text: city.name || PLEASE_SELECT_TIP })
232
248
  }
@@ -236,7 +252,9 @@ export default {
236
252
  return tabs
237
253
  },
238
254
  isCompleted() {
239
- return this.getTabItems.findIndex(t => t.text === PLEASE_SELECT_TIP) === -1
255
+ return (
256
+ this.getTabItems.findIndex(t => t.text === PLEASE_SELECT_TIP) === -1
257
+ )
240
258
  }
241
259
  },
242
260
  watch: {
@@ -260,8 +278,14 @@ export default {
260
278
  console.error(TAG, 'keyDefaultValue模式下defaultValue不能为对象类型')
261
279
  return false
262
280
  }
263
- if (!this.keyDefaultValue && !this.$pi.lang.isObject(this.defaultValue)) {
264
- console.error(TAG, '非keyDefaultValue模式下defaultValue必须为对象类型')
281
+ if (
282
+ !this.keyDefaultValue &&
283
+ !this.$pi.lang.isObject(this.defaultValue)
284
+ ) {
285
+ console.error(
286
+ TAG,
287
+ '非keyDefaultValue模式下defaultValue必须为对象类型'
288
+ )
265
289
  return false
266
290
  }
267
291
  }
@@ -274,9 +298,14 @@ export default {
274
298
  console.log(TAG, '地区选择组件初始化')
275
299
  let defaultCode = ''
276
300
  if (!this.$pi.lang.isEmpty(this.defaultValue)) {
277
- defaultCode = this.keyDefaultValue ? this.defaultValue : this.defaultValue.code
301
+ defaultCode = this.keyDefaultValue
302
+ ? this.defaultValue
303
+ : this.defaultValue.code
278
304
  }
279
- const regions = this.$pi.regions.parseRegions(defaultCode, this.regionsData)
305
+ const regions = this.$pi.regions.parseRegions(
306
+ defaultCode,
307
+ this.regionsData
308
+ )
280
309
  this.regions = regions
281
310
  // 默认都是展示tab最后一个列表
282
311
  this.tabCurrentItem = this.getTabItems[this.getTabItems.length - 1]
@@ -297,12 +326,16 @@ export default {
297
326
  const regionsKey = this.tabCurrentItem.id
298
327
 
299
328
  const isChange =
300
- (regionsKey === 'province' && this.regions.province.code !== region.code) ||
329
+ (regionsKey === 'province' &&
330
+ this.regions.province.code !== region.code) ||
301
331
  (regionsKey === 'city' && this.regions.city.code !== region.code)
302
332
 
303
333
  if (isChange) {
304
334
  // 判断是否切换了省份和城市,如果切换了需要重新生成新的数据
305
- this.regions = this.$pi.regions.parseRegions(region.code, this.regionsData)
335
+ this.regions = this.$pi.regions.parseRegions(
336
+ region.code,
337
+ this.regionsData
338
+ )
306
339
  } else {
307
340
  this.regions[regionsKey].code = region.code
308
341
  this.regions[regionsKey].name = region.name
@@ -17,7 +17,11 @@
17
17
  <slot v-if="$slots && ($slots.default || $slots.$default)" />
18
18
  <template v-else-if="title">{{ title }}</template>
19
19
  </view>
20
- <view v-if="($slots && $slots.desc) || desc" :style="[descStyle]" class="list-item-desc">
20
+ <view
21
+ v-if="($slots && $slots.desc) || desc"
22
+ :style="[descStyle]"
23
+ class="list-item-desc"
24
+ >
21
25
  <slot name="desc">{{ desc }}</slot>
22
26
  </view>
23
27
  </view>