sadais-piui 1.2.7-beta86 → 1.2.7-beta87

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.
@@ -16,6 +16,7 @@
16
16
  @close="handlePopupClose"
17
17
  @cancel="handleCancel"
18
18
  @confirm="handleConfirm"
19
+ @showed="handlePopupShow"
19
20
  >
20
21
  <view
21
22
  class="pi-cascader pi-h-100P pi-flex-column"
@@ -27,7 +28,7 @@
27
28
  <!-- 顶部面包屑 -->
28
29
  <scroll-view class="node-breadcrumb pi-solid-bottom-1" scroll-x>
29
30
  <view
30
- v-for="(item, index) in pathItems"
31
+ v-for="(item, index) in allPathItems"
31
32
  :key="index"
32
33
  class="breadcrumb-item"
33
34
  @click="handleClickItem(item)"
@@ -92,7 +93,7 @@
92
93
  </scroll-view>
93
94
  </scroll-view>
94
95
  <!-- 已选区域 -->
95
- <view class="cascader-area">
96
+ <view v-if="!isSingle" class="cascader-area">
96
97
  <text>{{ `已选(${selectedIds.length})` }}</text>
97
98
  <scroll-view class="scroll-area" scroll-x>
98
99
  <view
@@ -108,6 +109,31 @@
108
109
  </view>
109
110
  </scroll-view>
110
111
  </view>
112
+ <view v-else class="cascader-area">
113
+ <text>已选:</text>
114
+ <scroll-view
115
+ class="node-breadcrumb pi-solid-bottom-1"
116
+ scroll-x
117
+ style="flex: 1;padding-left: 0;overflow: hidden;"
118
+ >
119
+ <view
120
+ v-for="(item, index) in pathItems"
121
+ :key="index"
122
+ class="breadcrumb-item"
123
+ @click="handleClickItem(item)"
124
+ >
125
+ <pi-icon v-if="index > 0" name="right" custom-class="pi-mg-lr-6" />
126
+ <view
127
+ class="breadcrumb-item-title"
128
+ :class="{
129
+ active: currentItem && currentItem[keyField] === item[keyField]
130
+ }"
131
+ >
132
+ {{ item[displayField] }}
133
+ </view>
134
+ </view>
135
+ </scroll-view>
136
+ </view>
111
137
  </view>
112
138
  <slot name="footer" />
113
139
  </view>
@@ -230,7 +256,7 @@ export default {
230
256
  innerItems: [],
231
257
  itemsMap: {}, // 已选数据id索引
232
258
  selectedIds: [], // 已选数据
233
- cascaderWidth: 0, // 容器宽度
259
+ cascaderWidth: this.$pi.system.systemInfo.screenWidth, // 容器宽度
234
260
  scrollLeft: 0 // 视图左侧滚动区域,自动对齐到选择的栏目
235
261
  }
236
262
  },
@@ -302,12 +328,15 @@ export default {
302
328
  p = this.itemsMap[p.pid]
303
329
  }
304
330
  }
331
+ return pathItems
332
+ },
333
+ allPathItems() {
305
334
  return [
306
335
  {
307
336
  [this.displayField]: '全部',
308
337
  [this.keyField]: 'ROOT'
309
338
  }
310
- ].concat(pathItems)
339
+ ].concat(this.pathItems)
311
340
  }
312
341
  },
313
342
  watch: {
@@ -385,7 +414,7 @@ export default {
385
414
  handleClickItem(item) {
386
415
  // 点击全部
387
416
  if (item[this.keyField] === ROOT_NODE) {
388
- this.currentItem = cloneDeep(this.rootItem)
417
+ this.currentItem = this.$pi.lang.cloneDeep(this.rootItem)
389
418
  this.$nextTick(this.syncScrollLeft)
390
419
  return
391
420
  }
@@ -418,11 +447,16 @@ export default {
418
447
  this.selectedIds.push(item[this.keyField])
419
448
  }
420
449
  },
450
+ handlePopupShow() {
451
+ this.$emit('showd')
452
+ this.syncScrollLeft()
453
+ },
421
454
  async syncScrollLeft() {
422
455
  // 调用此方法的时候,必须使用$nextTick,因为column是动态变化的,需要等待界面更新渲染后,才能正确设置scrollLeft的位置
423
456
  let scrollLeft = 0
424
457
  if (this.cascaderWidth === 0) {
425
- const srollWrapRect = await this.$pi.common.queryRect(this, '.pi-cascader', false)
458
+ const srollWrapRect = await this.$pi.common.queryRect(this, '.cascader-wrap', false)
459
+ console.log(this, srollWrapRect)
426
460
  if (srollWrapRect) {
427
461
  this.cascaderWidth = srollWrapRect.width
428
462
  }
@@ -514,6 +548,7 @@ export default {
514
548
  .node-breadcrumb {
515
549
  width: 100%;
516
550
  padding-left: 32rpx;
551
+ padding-right: 32rpx;
517
552
  background: #ffffff;
518
553
  white-space: nowrap;
519
554
  .breadcrumb-item {
@@ -14,7 +14,6 @@
14
14
  'animation-duration': getDuration.css
15
15
  }
16
16
  ]"
17
-
18
17
  @tap.stop.prevent="handleCloseMask"
19
18
  >
20
19
  <view
@@ -15,6 +15,7 @@
15
15
  :z-index="getPopup.zIndex"
16
16
  :background="getPopup.background"
17
17
  @show="$emit('show')"
18
+ @showed="$emit('showed')"
18
19
  @close="handlePopupClose"
19
20
  >
20
21
  <view class="pi-popup-select pi-flex-column" :style="[customStyle]" :class="[customClass]">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta86",
3
+ "version": "1.2.7-beta87",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {