uview-plus 3.4.37 → 3.4.39

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,15 @@
1
+ ## 3.4.39(2025-05-31)
2
+ fix: 修改步骤条微信小程序下的布局 感谢@jiaruiyan
3
+
4
+ fix: u-tabs在屏幕尺寸发生变化时滑块位置没有发生变化 感谢@aqzhft
5
+
6
+ fix: 鸿蒙平台不支持plus.runtime.openWeb 感谢@aqzhft
7
+
8
+ ## 3.4.38(2025-05-30)
9
+ fix: 修复picker-data快捷组件缺少index
10
+
11
+ fix: 修复picker组件双向绑定初始化及取消后复原再次打开后的当前项目
12
+
1
13
  ## 3.4.37(2025-05-29)
2
14
  feat: modal支持设置动画时间
3
15
 
@@ -365,6 +365,9 @@ export default {
365
365
  // #ifdef APP-PLUS
366
366
  plus.runtime.openWeb(href)
367
367
  // #endif
368
+ // #ifdef APP-HARMONY
369
+ plus.runtime.openURL(href)
370
+ // #endif
368
371
  }
369
372
  } else {
370
373
  // 跳转页面
@@ -433,7 +433,12 @@ export default {
433
433
  } else if (href.includes('://')) {
434
434
  // 打开外链
435
435
  if (this.copyLink) {
436
- plus.runtime.openWeb(href)
436
+ // #ifdef APP-PLUS
437
+ plus.runtime.openWeb(href)
438
+ // #endif
439
+ // #ifdef APP-HARMONY
440
+ plus.runtime.openURL(href)
441
+ // #endif
437
442
  }
438
443
  } else {
439
444
  uni.navigateTo({
@@ -23,6 +23,7 @@ export default {
23
23
  confirmColor: '',
24
24
  visibleItemCount: 5,
25
25
  keyName: 'text',
26
+ valueName: 'value',
26
27
  closeOnClickOverlay: false,
27
28
  defaultIndex: [],
28
29
  immediateChange: true,
@@ -93,6 +93,11 @@ export const props = defineMixin({
93
93
  type: String,
94
94
  default: () => defProps.picker.keyName
95
95
  },
96
+ // 选项对象中,需要获取的属性值键名
97
+ valueName: {
98
+ type: String,
99
+ default: () => defProps.picker.valueName
100
+ },
96
101
  // 是否允许点击遮罩关闭选择器
97
102
  closeOnClickOverlay: {
98
103
  type: Boolean,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-picker-warrper">
2
+ <view class="u-picker-wraper">
3
3
  <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
4
4
  <slot :value="inputLabel">
5
5
  </slot>
@@ -124,6 +124,14 @@ export default {
124
124
  }
125
125
  },
126
126
  watch: {
127
+ // 监听columns参数的变化
128
+ columns: {
129
+ immediate: true,
130
+ deep:true,
131
+ handler(n) {
132
+ this.setColumns(n)
133
+ }
134
+ },
127
135
  // 监听默认索引的变化,重新设置对应的值
128
136
  defaultIndex: {
129
137
  immediate: true,
@@ -137,14 +145,41 @@ export default {
137
145
  }
138
146
  }
139
147
  },
140
- // 监听columns参数的变化
141
- columns: {
148
+ modelValue: {
142
149
  immediate: true,
143
150
  deep:true,
144
- handler(n) {
145
- this.setColumns(n)
151
+ handler(n,o) {
152
+ // 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
153
+ // v-model的值变化时候导致defaultIndexwatch也会执行的问题
154
+ //单纯vue不会出现
155
+ if (!o || n.join("/") != o.join("/")) {
156
+ let arr = [];
157
+ if (n != null) {
158
+ n.forEach((element, index) => {
159
+ let currentCols = this.getColumnValues(index)
160
+ if (currentCols && Object.prototype.toString.call(currentCols) === '[object Object]') {
161
+ currentCols.forEach((item, index2) => {
162
+ if (item[this.keyName] == element) {
163
+ arr.push(index2)
164
+ }
165
+ })
166
+ } else {
167
+ currentCols.forEach((item, index2) => {
168
+ if (item == element) {
169
+ arr.push(index2)
170
+ }
171
+ })
172
+ }
173
+ });
174
+ // alert(arr)
175
+ if (arr.length == 0 && this.defaultIndex) {
176
+ } else {
177
+ this.setIndexs(arr, true)
178
+ }
179
+ }
180
+ }
146
181
  }
147
- },
182
+ }
148
183
  },
149
184
  emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
150
185
  computed: {
@@ -178,9 +213,9 @@ export default {
178
213
  let res = []
179
214
  //区分是不是对象数组
180
215
  if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
181
- //对象数组返回id集合
216
+ //对象数组返回属性值集合
182
217
  items.forEach(element => {
183
- res.push(element && element['id'])
218
+ res.push(element && element[this.valueName])
184
219
  });
185
220
  } else {
186
221
  //非对象数组返回元素集合
@@ -213,6 +248,7 @@ export default {
213
248
  if (this.hasInput) {
214
249
  this.showByClickInput = false
215
250
  }
251
+ this.setDefault()
216
252
  this.$emit('update:show', false)
217
253
  this.$emit('close')
218
254
  }
@@ -222,14 +258,13 @@ export default {
222
258
  if (this.hasInput) {
223
259
  this.showByClickInput = false
224
260
  }
261
+ this.setDefault()
225
262
  this.$emit('update:show', false)
226
263
  this.$emit('cancel')
227
264
  },
228
- // 点击工具栏的确定按钮
229
- confirm() {
230
- //如果用户有没有触发过change
231
- if (!this.currentActiveValue.length) {
232
- let arr = [0]
265
+ setDefault() {
266
+ let arr = [0]
267
+ if (this.lastIndex.length == 0) {
233
268
  //如果有默认值&&默认值的数组长度是正确的,就用默认值
234
269
  if (Array.isArray(this.defaultIndex) && this.defaultIndex.length == this.innerColumns.length) {
235
270
  arr = [...this.defaultIndex];
@@ -237,13 +272,23 @@ export default {
237
272
  //否则默认都选中第一个
238
273
  arr = Array(this.innerColumns.length).fill(0);
239
274
  }
240
- this.setLastIndex(arr)
241
- this.setIndexs(arr)
275
+ } else {
276
+ arr = deepClone(this.lastIndex)
277
+ }
278
+ this.setLastIndex(arr)
279
+ this.setIndexs(arr)
280
+ },
281
+ // 点击工具栏的确定按钮
282
+ confirm() {
283
+ // 如果用户有没有触发过change
284
+ if (!this.currentActiveValue.length) {
285
+ this.setDefault()
242
286
  }
243
287
  this.$emit('update:modelValue', this.inputValue)
244
288
  if (this.hasInput) {
245
289
  this.showByClickInput = false
246
290
  }
291
+ this.setLastIndex(this.innerIndex)
247
292
  this.$emit('update:show', false)
248
293
  this.$emit('confirm', {
249
294
  indexs: this.innerIndex,
@@ -274,13 +319,14 @@ export default {
274
319
  this.columnIndex = columnIndex
275
320
  const values = this.innerColumns
276
321
  // 将当前的各项变化索引,设置为"上一次"的索引变化值
277
- this.setLastIndex(value)
322
+ // this.setLastIndex(value)
278
323
  this.setIndexs(value)
279
324
  //如果是非自带输入框才会在change时候触发v-model绑值的变化
280
325
  //否则会非常的奇怪,用户未确认,值就变了
281
- if (!this.hasInput) {
282
- this.$emit('update:modelValue', this.inputValue)
283
- }
326
+ // if (!this.hasInput) {
327
+ // this.$emit('update:modelValue', this.inputValue)
328
+ // }
329
+
284
330
  this.$emit('change', {
285
331
  // #ifndef MP-WEIXIN || MP-LARK
286
332
  // 微信小程序不能传递this,会因为循环引用而报错
@@ -74,7 +74,7 @@ export default {
74
74
  watch: {
75
75
  modelValue() {
76
76
  if (this.modelValue) {
77
- this.options.forEach((ele) => {
77
+ this.options.forEach((ele, index) => {
78
78
  if (ele[this.valueKey] == this.modelValue) {
79
79
  this.current = ele[this.labelKey]
80
80
  this.defaultIndex = [index]
@@ -21,7 +21,7 @@
21
21
  * @property {String} activeColor 激活状态颜色 (默认 '#3c9cff' )
22
22
  * @property {String} inactiveColor 未激活状态颜色 (默认 '#969799' )
23
23
  * @property {String} activeIcon 激活状态的图标
24
- * @property {String} inactiveIcon 未激活状态图标
24
+ * @property {String} inactiveIcon 未激活状态图标
25
25
  * @property {Boolean} dot 是否显示点类型 (默认 false )
26
26
  * @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
27
27
  */
@@ -85,6 +85,11 @@
85
85
  display: grid;
86
86
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
87
87
  /* #endif */
88
+
89
+ //微信小程序优化的比抖音的好 因此微信小程序使用flex布局
90
+ /* #ifdef MP-WEIXIN */
91
+ display: flex !important;
92
+ /* #endif */
88
93
  }
89
94
  }
90
95
  </style>
@@ -178,7 +178,14 @@
178
178
  },
179
179
  async mounted() {
180
180
  this.init()
181
+ this.windowResizeCallback = (res) => {
182
+ this.init()
183
+ }
184
+ uni.onWindowResize(this.windowResizeCallback)
181
185
  },
186
+ beforeUnmount() {
187
+ uni.offWindowResize(this.windowResizeCallback)
188
+ },
182
189
  emits: ['click', 'longPress', 'change', 'update:current'],
183
190
  methods: {
184
191
  addStyle,
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.4.37",
5
+ "version": "3.4.39",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水。",
7
7
  "keywords": [
8
8
  "uview",