uview-plus 3.3.8 → 3.3.9

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.
package/changelog.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 3.3.9(2024-08-01)
2
+ fix: 优化获取nvue元素
3
+
4
+ feat: modal新增contentTextAlign设置文案对齐方式
5
+
6
+ fix: 修复NVUE下tabbar文字不显示 #458
7
+
8
+ feat: loading-page增加zIndex属性
9
+
10
+ fix: 相册在宽度较小时换行问题
11
+
12
+ feat: album相册增加自适应自动换行模式
13
+
14
+ feat: album相册增加图片尺寸单位prop
15
+
16
+ fix: 修复calendar日历月份居中
17
+
1
18
  ## 3.3.8(2024-07-31)
2
19
  feat: slider支持进度条任意位置触发按钮拖动
3
20
 
@@ -66,6 +66,16 @@ export const props = defineMixin({
66
66
  radius: {
67
67
  type: [String, Number],
68
68
  default: () => defProps.image.radius
69
+ },
70
+ // 自适应换行
71
+ autoWrap: {
72
+ type: Boolean,
73
+ default: () => defProps.album.autoWrap
74
+ },
75
+ // 单位
76
+ unit: {
77
+ type: [String],
78
+ default: () => defProps.album.unit
69
79
  }
70
80
  }
71
81
  })
@@ -6,6 +6,7 @@
6
6
  v-for="(arr, index) in showUrls"
7
7
  :forComputedUse="albumWidth"
8
8
  :key="index"
9
+ :style="{flexWrap: autoWrap ? 'wrap' : 'nowrap'}"
9
10
  >
10
11
  <view
11
12
  class="u-album__row__wrapper"
@@ -85,6 +86,8 @@ const dom = uni.requireNativePlugin('dom')
85
86
  * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true )
86
87
  * @property {String} shape 图片形状,circle-圆形,square-方形 (默认 'square' )
87
88
  * @property {String | Number} radius 圆角值,单位任意,如果为数值,则为px单位 (默认 0 )
89
+ * @property {Boolean} autoWrap 自适应换行模式,不受rowCount限制,图片会自动换行 (默认 false )
90
+ * @property {String} unit 图片单位 (默认 px )
88
91
  * @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width )
89
92
  * @example <u-album :urls="urls2" @albumWidth="width => albumWidth = width" multipleSize="68" ></u-album>
90
93
  */
@@ -124,42 +127,48 @@ export default {
124
127
  marginBottom: addUnit(space)
125
128
  }
126
129
  // 如果为最后一行,则每个图片都无需下边框
127
- if (index1 === rowLen) style.marginBottom = 0
130
+ if (index1 === rowLen && !this.autoWrap) style.marginBottom = 0
128
131
  // 每行的最右边一张和总长度的最后一张无需右边框
129
- if (
130
- index2 === rowCount ||
131
- (index1 === rowLen &&
132
- index2 === this.showUrls[index1 - 1].length)
133
- )
134
- style.marginRight = 0
132
+ if (!this.autoWrap) {
133
+ if (
134
+ index2 === rowCount ||
135
+ (index1 === rowLen &&
136
+ index2 === this.showUrls[index1 - 1].length)
137
+ )
138
+ style.marginRight = 0
139
+ }
135
140
  return style
136
141
  }
137
142
  },
138
143
  // 将数组划分为二维数组
139
144
  showUrls() {
140
- const arr = []
141
- this.urls.map((item, index) => {
142
- // 限制最大展示数量
143
- if (index + 1 <= this.maxCount) {
144
- // 计算该元素为第几个素组内
145
- const itemIndex = Math.floor(index / this.rowCount)
146
- // 判断对应的索引是否存在
147
- if (!arr[itemIndex]) {
148
- arr[itemIndex] = []
145
+ if (this.autoWrap) {
146
+ return [ this.urls.slice(0, this.maxCount) ];
147
+ } else {
148
+ const arr = []
149
+ this.urls.map((item, index) => {
150
+ // 限制最大展示数量
151
+ if (index + 1 <= this.maxCount) {
152
+ // 计算该元素为第几个素组内
153
+ const itemIndex = Math.floor(index / this.rowCount)
154
+ // 判断对应的索引是否存在
155
+ if (!arr[itemIndex]) {
156
+ arr[itemIndex] = []
157
+ }
158
+ arr[itemIndex].push(item)
149
159
  }
150
- arr[itemIndex].push(item)
151
- }
152
- })
153
- return arr
160
+ })
161
+ return arr
162
+ }
154
163
  },
155
164
  imageWidth() {
156
165
  return addUnit(
157
- this.urls.length === 1 ? this.singleWidth : this.multipleSize
166
+ this.urls.length === 1 ? this.singleWidth : this.multipleSize, this.unit
158
167
  )
159
168
  },
160
169
  imageHeight() {
161
170
  return addUnit(
162
- this.urls.length === 1 ? this.singleHeight : this.multipleSize
171
+ this.urls.length === 1 ? this.singleHeight : this.multipleSize, this.unit
163
172
  )
164
173
  },
165
174
  // 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度
@@ -248,7 +257,6 @@ export default {
248
257
 
249
258
  &__row {
250
259
  @include flex(row);
251
- flex-wrap: wrap;
252
260
 
253
261
  &__wrapper {
254
262
  position: relative;
@@ -469,6 +469,7 @@
469
469
 
470
470
  &__title {
471
471
  display: flex;
472
+ flex-direction: column;
472
473
  font-size: 14px;
473
474
  line-height: 42px;
474
475
  height: 42px;
@@ -441,7 +441,14 @@
441
441
  // #endif
442
442
 
443
443
  // #ifdef APP-NVUE
444
- dom.getComponentRect(this.$refs.header, res => {
444
+ let headerRef = this.$refs.header
445
+ if (!headerRef) {
446
+ resolve({
447
+ width: 0,
448
+ height: 0
449
+ })
450
+ }
451
+ dom.getComponentRect(headerRef, res => {
445
452
  resolve(res.size)
446
453
  })
447
454
  // #endif
@@ -47,6 +47,11 @@ export const props = defineMixin({
47
47
  loadingColor: {
48
48
  type: String,
49
49
  default: () => defProps.loadingPage.loadingColor
50
- }
50
+ },
51
+ // 层级
52
+ zIndex: {
53
+ type: [Number],
54
+ default: () => defProps.loadingPage.zIndex
55
+ },
51
56
  }
52
57
  })
@@ -9,6 +9,8 @@
9
9
  bottom: 0,
10
10
  backgroundColor: bgColor,
11
11
  display: 'flex',
12
+ zIndex: zIndex,
13
+ ...customStyle
12
14
  }"
13
15
  >
14
16
  <view class="u-loading-page">
@@ -64,6 +66,7 @@ import { addUnit } from '../../libs/function/index';
64
66
  * @property {String | Number} fontSize 文字大小 (默认 19 )
65
67
  * @property {String | Number} iconSize 图标大小 (默认 28 )
66
68
  * @property {String} loadingColor 加载中图标的颜色,只能rgb或者十六进制颜色值 (默认 '#C8C8C8' )
69
+ * @property {Number} zIndex z-index层级 (默认10 )
67
70
  * @property {Object} customStyle 自定义样式
68
71
  * @example <u-loading mode="circle"></u-loading>
69
72
  */
@@ -81,6 +81,11 @@ export const props = defineMixin({
81
81
  confirmButtonShape: {
82
82
  type: String,
83
83
  default: () => defProps.modal.confirmButtonShape
84
- }
84
+ },
85
+ // 文案对齐方式
86
+ contentTextAlign: {
87
+ type: String,
88
+ default: () => defProps.modal.contentTextAlign
89
+ },
85
90
  }
86
91
  })
@@ -31,7 +31,9 @@
31
31
  }"
32
32
  >
33
33
  <slot>
34
- <text class="u-modal__content__text">{{ content }}</text>
34
+ <text class="u-modal__content__text" :style="{textAlign: contentTextAlign}">
35
+ {{ content }}
36
+ </text>
35
37
  </slot>
36
38
  </view>
37
39
  <view
@@ -127,10 +127,9 @@
127
127
  justify-content: center;
128
128
  flex: 1;
129
129
  /* #ifndef APP-NVUE */
130
-
131
- /* #endif */
132
130
  width: 100%;
133
131
  height: 100%;
132
+ /* #endif */
134
133
  /* #ifdef H5 */
135
134
  cursor: pointer;
136
135
  /* #endif */
@@ -20,6 +20,8 @@ export default {
20
20
  maxCount: 9,
21
21
  previewFullImage: true,
22
22
  rowCount: 3,
23
- showMore: true
23
+ showMore: true,
24
+ autoWrap: false,
25
+ unit: 'px'
24
26
  }
25
27
  }
@@ -18,6 +18,7 @@ export default {
18
18
  color: '#C8C8C8',
19
19
  fontSize: 19,
20
20
  iconSize: 28,
21
- loadingColor: '#C8C8C8'
21
+ loadingColor: '#C8C8C8',
22
+ zIndex: 10
22
23
  }
23
24
  }
@@ -25,6 +25,7 @@ export default {
25
25
  closeOnClickOverlay: false,
26
26
  negativeTop: 0,
27
27
  width: '650rpx',
28
- confirmButtonShape: ''
28
+ confirmButtonShape: '',
29
+ contentTextAlign: 'left'
29
30
  }
30
31
  }
@@ -130,8 +130,15 @@ export const mixin = defineMixin({
130
130
  let selectorNvue = selector.substring(1) // 去掉开头的#或者.
131
131
  let selectorRef = this.$refs[selectorNvue]
132
132
  if (!selectorRef) {
133
- console.log('不存在元素,请检查是否设置了ref属性' + selectorNvue + '。')
134
- resolve({})
133
+ // console.log('不存在元素,请检查是否设置了ref属性' + selectorNvue + '。')
134
+ resolve({
135
+ with: 0,
136
+ height: 0,
137
+ left: 0,
138
+ right: 0,
139
+ top: 0,
140
+ bottom: 0
141
+ })
135
142
  }
136
143
  dom.getComponentRect(selectorRef, res => {
137
144
  // console.log(res)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "uview-plus3.0重磅发布,全面的Vue3移动组件库。",
5
- "version": "3.3.8",
5
+ "version": "3.3.9",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",