Skip to content

Commit 2d7b6ee

Browse files
committed
uview update to 2022-01-20
1 parent ab37335 commit 2d7b6ee

14 files changed

Lines changed: 79 additions & 21 deletions

File tree

uni_modules/uview-ui/changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 2.0.22(2022-01-19)
2+
# uView2.0重磅发布,利剑出鞘,一统江湖
3+
4+
1. $u.page()方法优化,避免在特殊场景可能报错的问题
5+
2. picker组件添加immediateChange参数
6+
3. 新增$u.pages()方法
7+
## 2.0.21(2022-01-19)
8+
# uView2.0重磅发布,利剑出鞘,一统江湖
9+
10+
1. 优化:form组件在用户设置rules的时候提示用户model必传
11+
2. 优化遗留的通过正则判断rpx单位的问题
12+
3. 修复微信小程序环境中tabbar组件开启safeAreaInsetBottom属性后,placeholder高度填充不正确
13+
4. 修复swiper在current指定非0时缩放有误
14+
5. 修复u-icon添加stop属性的时候报错
15+
6. 修复upload组件在accept=all的时候没有作用
16+
7. 修复在text组件mode为phone时call属性无效的问题
17+
8. 处理u-form clearValidate方法
18+
9. 其他修复
119
## 2.0.20(2022-01-14)
220
# uView2.0重磅发布,利剑出鞘,一统江湖
321

uni_modules/uview-ui/components/u-form/u-form.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
setRules(rules) {
9191
// 判断是否有规则
9292
if (Object.keys(rules).length === 0) return;
93+
if (Object.keys(this.model).length === 0) {
94+
uni.$u.error('设置rules,model必须设置!');
95+
return;
96+
};
9397
this.formRules = rules;
9498
// 重新将规则赋予Validator
9599
this.validator = new Schema(rules);
@@ -119,6 +123,10 @@
119123
},
120124
// 对部分表单字段进行校验
121125
async validateField(value, callback, event = null) {
126+
if (Object.keys(this.formRules).length === 0) {
127+
uni.$u.error('未设置rules,请看文档说明!');
128+
return;
129+
}
122130
// $nextTick是必须的,否则model的变更,可能会延后于此方法的执行
123131
this.$nextTick(() => {
124132
// 校验错误信息,返回给回调方法,用于存放所有form-item的错误信息

uni_modules/uview-ui/components/u-icon/u-icon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
clickHandler(e) {
140140
this.$emit('click', this.index)
141141
// 是否阻止事件冒泡
142-
this.stop && uni.$u.preventEvent(e)
142+
this.stop && this.preventEvent(e)
143143
}
144144
}
145145
}

uni_modules/uview-ui/components/u-image/u-image.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,20 @@
117117
if (!n) {
118118
// 如果传入null或者'',或者false,或者undefined,标记为错误状态
119119
this.isError = true
120-
this.loading = false
120+
121121
} else {
122122
this.isError = false
123+
this.loading = false
123124
}
124125
}
125126
}
126127
},
127128
computed: {
128129
wrapStyle() {
129130
let style = {};
131+
// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
132+
style.width = this.$u.addUnit(this.width);
133+
style.height = this.$u.addUnit(this.height);
130134
// 如果是显示圆形,设置一个很多的半径值即可
131135
style.borderRadius = this.shape == 'circle' ? '10000px' : uni.$u.addUnit(this.radius)
132136
// 如果设置圆角,必须要有hidden,否则可能圆角无效
@@ -205,6 +209,11 @@
205209
position: relative;
206210
transition: opacity 0.5s ease-in-out;
207211
212+
&__image {
213+
width: 100%;
214+
height: 100%;
215+
}
216+
208217
&__loading,
209218
&__error {
210219
position: absolute;

uni_modules/uview-ui/components/u-index-list/u-index-list.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<slot name="header" />
1919
</cell>
2020
<slot />
21-
<cell v-if="$slots.header">
21+
<cell v-if="$slots.footer">
2222
<slot name="footer" />
2323
</cell>
2424
</list>
@@ -39,7 +39,7 @@
3939
<slot name="header" />
4040
</view>
4141
<slot />
42-
<view v-if="$slots.header">
42+
<view v-if="$slots.footer">
4343
<slot name="footer" />
4444
</view>
4545
</scroll-view>

uni_modules/uview-ui/components/u-picker/props.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ export default {
7474
defaultIndex: {
7575
type: Array,
7676
default: uni.$u.props.picker.defaultIndex
77-
}
77+
},
78+
// 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件,只在微信2.21.1及以上有效
79+
immediateChange: {
80+
type: Boolean,
81+
default: uni.$u.props.picker.immediateChange
82+
}
7883
}
7984
}

uni_modules/uview-ui/components/u-picker/u-picker.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class="u-picker__view"
1919
:indicatorStyle="`height: ${$u.addUnit(itemHeight)}`"
2020
:value="innerIndex"
21+
:immediateChange="immediateChange"
2122
:style="{
2223
height: `${$u.addUnit(visibleItemCount * itemHeight)}`
2324
}"
@@ -70,6 +71,7 @@
7071
* @property {String} keyName 选项对象中,需要展示的属性键名(默认 'text' )
7172
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭选择器(默认 false )
7273
* @property {Array} defaultIndex 各列的默认索引
74+
* @property {Boolean} immediateChange 是否在手指松开时立即触发change事件(默认 false )
7375
* @event {Function} close 关闭选择器时触发
7476
* @event {Function} cancel 点击取消按钮触发
7577
* @event {Function} change 当选择值变化时触发

uni_modules/uview-ui/components/u-popup/u-popup.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
:show="show"
55
@click="overlayClick"
66
v-if="overlay"
7-
:duration="duration"
7+
:duration="overlayDuration"
88
:customStyle="overlayStyle"
99
:opacity="overlayOpacity"
1010
></u-overlay>
1111
<u-transition
1212
:show="show"
1313
:customStyle="transitionStyle"
1414
:mode="position"
15-
:duration="duration"
15+
:duration="duration1"
1616
@after-enter="afterEnter"
1717
@click="clickHandler"
1818
>
@@ -55,6 +55,7 @@
5555
* @property {Boolean} overlay 是否显示遮罩 (默认 true )
5656
* @property {String} mode 弹出方向(默认 'bottom' )
5757
* @property {String | Number} duration 动画时长,单位ms (默认 300 )
58+
* @property {String | Number} overlayDuration 遮罩层动画时长,单位ms (默认 350 )
5859
* @property {Boolean} closeable 是否显示关闭图标(默认 false )
5960
* @property {Object | String} overlayStyle 自定义遮罩的样式
6061
* @property {String | Number} overlayOpacity 遮罩透明度,0-1之间(默认 0.5)
@@ -74,7 +75,9 @@
7475
name: 'u-popup',
7576
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
7677
data() {
77-
return {}
78+
return {
79+
overlayDuration: this.duration + 50
80+
}
7881
},
7982
watch: {
8083
show(newValue, oldValue) {

uni_modules/uview-ui/components/u-swiper/u-swiper.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
currentIndex: 0
132132
}
133133
},
134+
watch: {
135+
current(val, preVal) {
136+
if(val === preVal) return;
137+
this.currentIndex = val; // 和上游数据关联上
138+
}
139+
},
134140
computed: {
135141
itemStyle() {
136142
return index => {

uni_modules/uview-ui/components/u-tabbar/u-tabbar.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
// 延时一定时间
9595
await uni.$u.sleep(20)
9696
// #ifndef APP-NVUE
97-
this.$uGetRect('.u-tabbar__content').then(size => {
98-
this.placeholderHeight = 50
97+
this.$uGetRect('.u-tabbar__content').then(({height = 50}) => {
98+
// 修复IOS safearea bottom 未填充高度
99+
this.placeholderHeight = height
99100
})
100101
// #endif
101102

0 commit comments

Comments
 (0)