uview-plus 3.3.9 → 3.3.10
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 +17 -0
- package/components/u-action-sheet/u-action-sheet.vue +4 -1
- package/components/u-datetime-picker/u-datetime-picker.vue +1 -0
- package/components/u-form/u-form.vue +70 -41
- package/components/u-grid/u-grid.vue +1 -1
- package/components/u-grid-item/u-grid-item.vue +5 -0
- package/components/u-index-list/u-index-list.vue +8 -6
- package/components/u-input/u-input.vue +3 -2
- package/components/u-slider/u-slider.vue +1 -0
- package/components/u-steps/u-steps.vue +7 -0
- package/components/u-steps-item/props.js +6 -1
- package/components/u-steps-item/u-steps-item.vue +15 -3
- package/components/u-waterfall/u-waterfall.vue +2 -0
- package/libs/config/props/input.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 3.3.10(2024-08-02)
|
|
2
|
+
fix: 修复index-list偶发的滑动最后一个索引报错top不存在
|
|
3
|
+
|
|
4
|
+
fix: 修复gird在QQ、抖音小程序下布局
|
|
5
|
+
|
|
6
|
+
feat: 优化step支持自定义样式prop
|
|
7
|
+
|
|
8
|
+
feat: action-sheet组件支持v-model:show双向绑定
|
|
9
|
+
|
|
10
|
+
fix: 小程序下steps和grid都统一采用grid布局
|
|
11
|
+
|
|
12
|
+
fix: 修复支付宝小程序下input类型为数字时双向绑定失效
|
|
13
|
+
|
|
14
|
+
feat : form 表单 validate 校验不通过后 error增加字段prop信息 #304
|
|
15
|
+
|
|
16
|
+
fix: form组件异步校异常验问题 #393
|
|
17
|
+
|
|
1
18
|
## 3.3.9(2024-08-01)
|
|
2
19
|
fix: 优化获取nvue元素
|
|
3
20
|
|
|
@@ -166,16 +166,18 @@
|
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
168
|
},
|
|
169
|
-
emits: ["close", "select"],
|
|
169
|
+
emits: ["close", "select", "update:show"],
|
|
170
170
|
methods: {
|
|
171
171
|
closeHandler() {
|
|
172
172
|
// 允许点击遮罩关闭时,才发出close事件
|
|
173
173
|
if(this.closeOnClickOverlay) {
|
|
174
|
+
this.$emit('update:show')
|
|
174
175
|
this.$emit('close')
|
|
175
176
|
}
|
|
176
177
|
},
|
|
177
178
|
// 点击取消按钮
|
|
178
179
|
cancel() {
|
|
180
|
+
this.$emit('update:show')
|
|
179
181
|
this.$emit('close')
|
|
180
182
|
},
|
|
181
183
|
selectHandler(index) {
|
|
@@ -183,6 +185,7 @@
|
|
|
183
185
|
if (item && !item.disabled && !item.loading) {
|
|
184
186
|
this.$emit('select', item)
|
|
185
187
|
if (this.closeOnClickAction) {
|
|
188
|
+
this.$emit('update:show')
|
|
186
189
|
this.$emit('close')
|
|
187
190
|
}
|
|
188
191
|
}
|
|
@@ -134,54 +134,82 @@
|
|
|
134
134
|
// 如果为字符串,转为数组
|
|
135
135
|
value = [].concat(value);
|
|
136
136
|
// 历遍children所有子form-item
|
|
137
|
-
this.children.map(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
let promises = this.children.map(child => {
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
// 用于存放form-item的错误信息
|
|
140
|
+
const childErrors = [];
|
|
141
|
+
if (value.includes(child.prop)) {
|
|
142
|
+
// 获取对应的属性,通过类似'a.b.c'的形式
|
|
143
|
+
const propertyVal = getProperty(
|
|
144
|
+
this.model,
|
|
145
|
+
child.prop
|
|
146
|
+
);
|
|
147
|
+
// 属性链数组
|
|
148
|
+
const propertyChain = child.prop.split(".");
|
|
149
|
+
const propertyName =
|
|
150
|
+
propertyChain[propertyChain.length - 1];
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
const rule = this.formRules[child.rule || child.prop];
|
|
153
|
+
// 如果不存在对应的规则,直接返回,否则校验器会报错
|
|
154
|
+
if (!rule) {
|
|
155
|
+
resolve()
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
// rule规则可为数组形式,也可为对象形式,此处拼接成为数组
|
|
159
|
+
const rules = [].concat(rule);
|
|
156
160
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
// 对rules数组进行校验
|
|
162
|
+
if (!rules.length) {
|
|
163
|
+
resolve()
|
|
164
|
+
}
|
|
165
|
+
for (let i = 0; i < rules.length; i++) {
|
|
166
|
+
const ruleItem = rules[i];
|
|
167
|
+
// 将u-form-item的触发器转为数组形式
|
|
168
|
+
const trigger = [].concat(ruleItem?.trigger);
|
|
169
|
+
// 如果是有传入触发事件,但是此form-item却没有配置此触发器的话,不执行校验操作
|
|
170
|
+
if (event && !trigger.includes(event)) {
|
|
171
|
+
resolve()
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
// 实例化校验对象,传入构造规则
|
|
175
|
+
const validator = new Schema({
|
|
176
|
+
[propertyName]: ruleItem,
|
|
177
|
+
});
|
|
178
|
+
validator.validate({
|
|
169
179
|
[propertyName]: propertyVal,
|
|
170
180
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
(errors, fields) => {
|
|
182
|
+
if (test.array(errors)) {
|
|
183
|
+
errors.forEach(element => {
|
|
184
|
+
element.prop = child.prop;
|
|
185
|
+
});
|
|
186
|
+
errorsRes.push(...errors);
|
|
187
|
+
childErrors.push(...errors);
|
|
188
|
+
}
|
|
189
|
+
child.message =
|
|
190
|
+
childErrors[0]?.message ? childErrors[0].message : null;
|
|
191
|
+
|
|
192
|
+
if (i == (rules.length - 1)) {
|
|
193
|
+
resolve(errorsRes)
|
|
194
|
+
}
|
|
175
195
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
resolve({})
|
|
180
200
|
}
|
|
181
|
-
}
|
|
201
|
+
});
|
|
182
202
|
});
|
|
183
|
-
|
|
184
|
-
|
|
203
|
+
|
|
204
|
+
// 使用Promise.all来等待所有Promise完成
|
|
205
|
+
Promise.all(promises)
|
|
206
|
+
.then(results => {
|
|
207
|
+
// 执行回调函数
|
|
208
|
+
typeof callback === "function" && callback(errorsRes);
|
|
209
|
+
})
|
|
210
|
+
.catch(error => {
|
|
211
|
+
console.error('An error occurred:', error);
|
|
212
|
+
});
|
|
185
213
|
});
|
|
186
214
|
},
|
|
187
215
|
// 校验全部数据
|
|
@@ -198,6 +226,7 @@
|
|
|
198
226
|
const formItemProps = this.children.map(
|
|
199
227
|
(item) => item.prop
|
|
200
228
|
);
|
|
229
|
+
// console.log(formItemProps)
|
|
201
230
|
this.validateField(formItemProps, (errors) => {
|
|
202
231
|
if(errors.length) {
|
|
203
232
|
// 如果错误提示方式为toast,则进行提示
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
align-items: center;
|
|
106
106
|
// 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
|
|
107
107
|
// 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
|
|
108
|
-
/* #ifdef MP
|
|
108
|
+
/* #ifdef MP */
|
|
109
109
|
display: grid;
|
|
110
110
|
grid-template-columns: repeat(v-bind(col), 1fr);
|
|
111
111
|
/* #endif */
|
|
@@ -361,16 +361,16 @@
|
|
|
361
361
|
// pageY += sys().windowTop
|
|
362
362
|
// #endif
|
|
363
363
|
// 对第一和最后一个字母做边界处理,因为用户可能在字母列表上触摸到两端的尽头后依然继续滑动
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
console.log('top1', top)
|
|
365
|
+
console.log('height', height)
|
|
366
366
|
top = top - (height / 2) // 减去transfrom的translateY值导致的高度
|
|
367
367
|
pageY = pageY - this.topOffset
|
|
368
368
|
// if (this.safeBottomFix) {
|
|
369
369
|
// pageY = pageY + 34
|
|
370
370
|
// }
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
console.log('topOffset', this.topOffset)
|
|
372
|
+
console.log('pageY', pageY)
|
|
373
|
+
console.log('top2', top)
|
|
374
374
|
if (pageY < top) {
|
|
375
375
|
index = 0
|
|
376
376
|
} else if (pageY >= top + height) {
|
|
@@ -418,7 +418,9 @@
|
|
|
418
418
|
return child
|
|
419
419
|
})
|
|
420
420
|
// console.log('this.children[currentIndex].top', children[currentIndex].top)
|
|
421
|
-
|
|
421
|
+
if (children[currentIndex]?.top) {
|
|
422
|
+
this.scrollTop = children[currentIndex].top - getPx(customNavHeight)
|
|
423
|
+
}
|
|
422
424
|
// #endif
|
|
423
425
|
|
|
424
426
|
// #ifdef APP-NVUE
|
|
@@ -91,7 +91,7 @@ import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '
|
|
|
91
91
|
* @property {String} disabledColor 禁用状态时的背景色( 默认 '#f5f7fa' )
|
|
92
92
|
* @property {Boolean} clearable 是否显示清除控件 ( 默认 false )
|
|
93
93
|
* @property {Boolean} password 是否密码类型 ( 默认 false )
|
|
94
|
-
* @property {
|
|
94
|
+
* @property {Number} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度 ( 默认 -1 )
|
|
95
95
|
* @property {String} placeholder 输入框为空时的占位符
|
|
96
96
|
* @property {String} placeholderClass 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ ( 默认 'input-placeholder' )
|
|
97
97
|
* @property {String | Object} placeholderStyle 指定placeholder的样式,字符串/对象形式,如"color: red;"
|
|
@@ -102,7 +102,7 @@ import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '
|
|
|
102
102
|
* @property {Boolean} focus 自动获取焦点,在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 ( 默认 false )
|
|
103
103
|
* @property {Boolean} autoBlur 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 ( 默认 false )
|
|
104
104
|
* @property {Boolean} disableDefaultPadding 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 ( 默认 false )
|
|
105
|
-
* @property {String | Number} cursor 指定focus时光标的位置( 默认
|
|
105
|
+
* @property {String | Number} cursor 指定focus时光标的位置( 默认 140 )
|
|
106
106
|
* @property {String | Number} cursorSpacing 输入框聚焦时底部与键盘的距离 ( 默认 30 )
|
|
107
107
|
* @property {String | Number} selectionStart 光标起始位置,自动聚集时有效,需与selection-end搭配使用 ( 默认 -1 )
|
|
108
108
|
* @property {String | Number} selectionEnd 光标结束位置,自动聚集时有效,需与selection-start搭配使用 ( 默认 -1 )
|
|
@@ -234,6 +234,7 @@ export default {
|
|
|
234
234
|
onInput(e) {
|
|
235
235
|
let { value = "" } = e.detail || {};
|
|
236
236
|
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
237
|
+
// console.log('onInput', value, this.innerValue)
|
|
237
238
|
this.innerValue = value;
|
|
238
239
|
this.$nextTick(() => {
|
|
239
240
|
let formatValue = this.innerFormatter(value);
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
},
|
|
62
62
|
created() {
|
|
63
63
|
this.children = []
|
|
64
|
+
},
|
|
65
|
+
options: {
|
|
66
|
+
virtualHost: false
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
</script>
|
|
@@ -78,6 +81,10 @@
|
|
|
78
81
|
&--row {
|
|
79
82
|
flex-direction: row;
|
|
80
83
|
flex: 1;
|
|
84
|
+
/* #ifdef MP */
|
|
85
|
+
display: grid;
|
|
86
|
+
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
87
|
+
/* #endif */
|
|
81
88
|
}
|
|
82
89
|
}
|
|
83
90
|
</style>
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<view class="u-steps-item__line" v-if="index + 1 < childLength"
|
|
4
4
|
:class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
|
|
5
5
|
<view class="u-steps-item__wrapper"
|
|
6
|
-
:class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]"
|
|
6
|
+
:class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]"
|
|
7
|
+
:style="[itemStyle]">
|
|
7
8
|
<slot name="icon">
|
|
8
9
|
<view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
|
|
9
10
|
backgroundColor: statusColor
|
|
@@ -95,6 +96,11 @@
|
|
|
95
96
|
created() {
|
|
96
97
|
this.init()
|
|
97
98
|
},
|
|
99
|
+
// #ifdef MP-TOUTIAO
|
|
100
|
+
options: {
|
|
101
|
+
virtualHost: false
|
|
102
|
+
},
|
|
103
|
+
// #endif
|
|
98
104
|
computed: {
|
|
99
105
|
lineStyle() {
|
|
100
106
|
const style = {}
|
|
@@ -111,6 +117,11 @@
|
|
|
111
117
|
.current ? this.parentData.activeColor : this.parentData.inactiveColor
|
|
112
118
|
return style
|
|
113
119
|
},
|
|
120
|
+
itemStyle() {
|
|
121
|
+
return {
|
|
122
|
+
...this.itemStyle
|
|
123
|
+
}
|
|
124
|
+
},
|
|
114
125
|
statusClass() {
|
|
115
126
|
const {
|
|
116
127
|
index,
|
|
@@ -231,10 +242,11 @@
|
|
|
231
242
|
align-items: center;
|
|
232
243
|
position: relative;
|
|
233
244
|
background-color: #fff;
|
|
245
|
+
border-radius: 50px;
|
|
234
246
|
|
|
235
247
|
&--column {
|
|
236
248
|
width: 20px;
|
|
237
|
-
height:
|
|
249
|
+
height: 20px;
|
|
238
250
|
|
|
239
251
|
&--dot {
|
|
240
252
|
height: 20px;
|
|
@@ -243,7 +255,7 @@
|
|
|
243
255
|
}
|
|
244
256
|
|
|
245
257
|
&--row {
|
|
246
|
-
width:
|
|
258
|
+
width: 20px;
|
|
247
259
|
height: 20px;
|
|
248
260
|
|
|
249
261
|
&--dot {
|