Skip to content

Commit 9dab214

Browse files
committed
uview update to 2022-10-08
1 parent cb0566d commit 9dab214

15 files changed

Lines changed: 294 additions & 288 deletions

File tree

components/goods-pop/goods-pop.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
goodsAddition: undefined,
118118
faved: false,
119119
properties: undefined,
120+
lock: false
120121
}
121122
},
122123
watch: {
@@ -136,7 +137,7 @@
136137
},
137138
methods: {
138139
_initData() {
139-
if (!this.goodsDetail) {
140+
if (this.lock || !this.goodsDetail) {
140141
return
141142
}
142143
this.pic = this.goodsDetail.basicInfo.pic
@@ -157,10 +158,12 @@
157158
this.goodsFavCheck()
158159
},
159160
close() {
161+
this.lock = false
160162
this.$emit('close')
161163
},
162164
// sku 选择事件
163165
async skuSelect(index, index2) {
166+
this.lock = true
164167
this.buyNumber = 1
165168
const properties = this.goodsDetail.properties
166169
const p = properties[index]

uni_modules/uview-ui/changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 2.0.34(2022-09-24)
2+
# uView2.0重磅发布,利剑出鞘,一统江湖
3+
4+
1. `u-input``u-textarea`增加`ignoreCompositionEvent`属性
5+
2. 修复`route`方法调用可能报错的问题
6+
3. 修复`u-no-network`组件`z-index`无效的问题
7+
4. 修复`textarea`组件在h5上confirmType=""报错的问题
8+
5. `u-rate`适配`nvue`
9+
6. 优化验证手机号码的正则表达式(根据工信部发布的《电信网编号计划(2017年版)》进行修改。)
10+
7. `form-item`添加`labelPosition`属性
11+
8. `u-calendar`修复`maxDate`设置为当前日期,并且当前时间大于08:00时无法显示日期列表的问题 (#724)
12+
9. `u-radio`增加一个默认插槽用于自定义修改label内容 (#680)
13+
10. 修复`timeFormat`函数在safari重的兼容性问题 (#664)
114
## 2.0.33(2022-06-17)
215
# uView2.0重磅发布,利剑出鞘,一统江湖
316

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,13 @@ export default {
209209
}
210210
},
211211
init() {
212-
// 校验maxDate,不能小于当前时间
212+
// 校验maxDate,不能小于minDate
213213
if (
214214
this.innerMaxDate &&
215-
new Date(this.innerMaxDate).getTime() <= Date.now()
215+
this.innerMinDate &&
216+
new Date(this.innerMaxDate).getTime() < new Date(this.innerMinDate).getTime()
216217
) {
217-
return uni.$u.error('maxDate不能小于当前时间')
218+
return uni.$u.error('maxDate不能小于minDate')
218219
}
219220
// 滚动区域的高度
220221
this.listHeight = this.rowHeight * 5 + 30

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
* @property {String} endText 倒计结束的提示语,见官网说明(默认 '重新获取' )
1717
* @property {Boolean} keepRunning 是否在H5刷新或各端返回再进入时继续倒计时( 默认false )
1818
* @property {String} uniqueKey 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
19-
*
19+
*
2020
* @event {Function} change 倒计时期间,每秒触发一次
2121
* @event {Function} start 开始倒计时触发
2222
* @event {Function} end 结束倒计时触发
23-
* @example <u-code ref="uCode" @change="codeChange" seconds="20"></u-code>
23+
* @example <u-code ref="uCode" @change="codeChange" seconds="20"></u-code>
2424
*/
2525
export default {
2626
name: "u-code",
@@ -74,7 +74,6 @@
7474
this.canGetCode = false
7575
// 这里放这句,是为了一开始时就提示,否则要等setInterval的1秒后才会有提示
7676
this.changeEvent(this.changeText.replace(/x|X/, this.secNum))
77-
this.setTimeToStorage()
7877
this.timer = setInterval(() => {
7978
if (--this.secNum) {
8079
// 用当前倒计时的秒数替换提示字符串中的"x"字母
@@ -88,7 +87,8 @@
8887
this.canGetCode = true
8988
}
9089
}, 1000)
91-
},
90+
this.setTimeToStorage()
91+
},
9292
// 重置,可以让用户再次获取验证码
9393
reset() {
9494
this.canGetCode = true
Lines changed: 120 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,127 @@
11
<template>
2-
<view class="u-drawdown-item">
3-
<u-overlay
4-
customStyle="top: 126px"
5-
:show="show"
6-
:closeOnClickOverlay="closeOnClickOverlay"
7-
@click="overlayClick"
8-
></u-overlay>
9-
<view
10-
class="u-drawdown-item__content"
11-
:style="[style]"
12-
:animation="animationData"
13-
ref="animation"
14-
>
15-
<slot />
16-
</view>
17-
</view>
2+
<view class="u-drawdown">
3+
<view
4+
class="u-dropdown__menu"
5+
:style="{
6+
height: $u.addUnit(height)
7+
}"
8+
ref="u-dropdown__menu"
9+
>
10+
<view
11+
class="u-dropdown__menu__item"
12+
v-for="(item, index) in menuList"
13+
:key="index"
14+
@tap.stop="clickHandler(item, index)"
15+
>
16+
<view class="u-dropdown__menu__item__content">
17+
<text
18+
class="u-dropdown__menu__item__content__text"
19+
:style="[index === current ? activeStyle : inactiveStyle]"
20+
>{{item.title}}</text>
21+
<view
22+
class="u-dropdown__menu__item__content__arrow"
23+
:class="[index === current && 'u-dropdown__menu__item__content__arrow--rotate']"
24+
>
25+
<u-icon
26+
:name="menuIcon"
27+
:size="$u.addUnit(menuIconSize)"
28+
></u-icon>
29+
</view>
30+
</view>
31+
</view>
32+
</view>
33+
<view class="u-dropdown__content">
34+
<slot />
35+
</view>
36+
</view>
1837
</template>
1938

2039
<script>
21-
// #ifdef APP-NVUE
22-
const animation = uni.requireNativePlugin('animation')
23-
const dom = uni.requireNativePlugin('dom')
24-
// #endif
25-
import props from './props.js';
26-
/**
27-
* Drawdownitem
28-
* @description
29-
* @tutorial url
30-
* @property {String}
31-
* @event {Function}
32-
* @example
33-
*/
34-
export default {
35-
name: 'u-drawdown-item',
36-
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
37-
data() {
38-
return {
39-
show: false,
40-
top: '126px',
41-
// uni.createAnimation的导出数据
42-
animationData: {},
43-
}
44-
},
45-
mounted() {
46-
this.init()
47-
},
48-
watch: {
49-
// 发生变化时,需要去更新父组件对应的值
50-
dataChange(newValue, oldValue) {
51-
this.updateParentData()
52-
}
53-
},
54-
computed: {
55-
// 监听对应变量的变化
56-
dataChange() {
57-
return [this.title, this.disabled]
58-
},
59-
style() {
60-
const style = {
61-
zIndex: 10071,
62-
position: 'fixed',
63-
display: 'flex',
64-
left: 0,
65-
right: 0
66-
}
67-
style.top = uni.$u.addUnit(this.top)
68-
return style
69-
}
70-
},
71-
methods: {
72-
init() {
73-
this.updateParentData()
74-
},
75-
// 更新父组件所需的数据
76-
updateParentData() {
77-
// 获取父组件u-dropdown
78-
this.getParentData('u-dropdown')
79-
if (!this.parent) uni.$u.error('u-dropdown-item必须配合u-dropdown使用')
80-
// 查找父组件menuList数组中对应的标题数据
81-
const menuIndex = this.parent.menuList.findIndex(item => item.title === this.title)
82-
const menuContent = {
83-
title: this.title,
84-
disabled: this.disabled
85-
}
86-
if (menuIndex >= 0) {
87-
// 如果能找到,则直接修改
88-
this.parent.menuList[menuIndex] = menuContent;
89-
} else {
90-
// 如果无法找到,则为第一次添加,直接push即可
91-
this.parent.menuList.push(menuContent);
92-
}
93-
},
94-
async setContentAnimate(height) {
95-
this.animating = true
96-
// #ifdef APP-NVUE
97-
const ref = this.$refs['animation'].ref
98-
animation.transition(ref, {
99-
styles: {
100-
height: uni.$u.addUnit(height)
101-
},
102-
duration: this.duration,
103-
timingFunction: 'ease-in-out',
104-
}, () => {
105-
this.animating = false
106-
})
107-
// #endif
108-
109-
// #ifndef APP-NVUE
110-
const animation = uni.createAnimation({
111-
timingFunction: 'ease-in-out',
112-
});
113-
animation
114-
.height(height)
115-
.step({
116-
duration: this.duration,
117-
})
118-
.step()
119-
// 导出动画数据给面板的animationData值
120-
this.animationData = animation.export()
121-
// 标识动画结束
122-
uni.$u.sleep(this.duration).then(() => {
123-
this.animating = false
124-
})
125-
// #endif
126-
},
127-
overlayClick() {
128-
this.show = false
129-
this.setContentAnimate(0)
130-
}
131-
},
132-
}
40+
import props from './props.js';
41+
/**
42+
* Dropdown
43+
* @description
44+
* @tutorial url
45+
* @property {String}
46+
* @event {Function}
47+
* @example
48+
*/
49+
export default {
50+
name: 'u-dropdown',
51+
mixins: [uni.$u.mixin, props],
52+
data() {
53+
return {
54+
// �˵�����
55+
menuList: [],
56+
current: 0
57+
}
58+
},
59+
computed: {
60+
61+
},
62+
created() {
63+
// �������������(u-dropdown-item)��this��������data������������������΢��С��������ѭ�����ö�����
64+
this.children = [];
65+
},
66+
methods: {
67+
clickHandler(item, index) {
68+
this.children.map(child => {
69+
if(child.title === item.title) {
70+
// this.queryRect('u-dropdown__menu').then(size => {
71+
child.$emit('click')
72+
child.setContentAnimate(child.show ? 0 : 300)
73+
child.show = !child.show
74+
// })
75+
} else {
76+
child.show = false
77+
child.setContentAnimate(0)
78+
}
79+
})
80+
},
81+
// ��ȡ��ǩ�ijߴ�λ��
82+
queryRect(el) {
83+
// #ifndef APP-NVUE
84+
// $uGetRectΪuView�Դ��Ľڵ��ѯ�򻯷���������ĵ����ܣ�https://www.uviewui.com/js/getRect.html
85+
// ����ڲ�һ����this.$uGetRect�������Ϊthis.$u.getRect�����߹���һ�£����Ʋ�ͬ
86+
return new Promise(resolve => {
87+
this.$uGetRect(`.${el}`).then(size => {
88+
resolve(size)
89+
})
90+
})
91+
// #endif
92+
93+
// #ifdef APP-NVUE
94+
// nvue�£�ʹ��domģ���ѯԪ�ظ߶�
95+
// ����һ��promise���õ��ô˷�����������ʹ��then�ص�
96+
return new Promise(resolve => {
97+
dom.getComponentRect(this.$refs[el], res => {
98+
resolve(res.size)
99+
})
100+
})
101+
// #endif
102+
},
103+
},
104+
}
133105
</script>
134106

135-
<style lang="scss" scoped>
136-
@import '../../libs/css/components.scss';
137-
138-
.u-drawdown-item {
139-
140-
&__content {
141-
background-color: #FFFFFF;
142-
overflow: hidden;
143-
height: 0;
144-
}
145-
}
107+
<style lang="scss">
108+
@import '../../libs/css/components.scss';
109+
110+
.u-dropdown {
111+
112+
&__menu {
113+
@include flex;
114+
115+
&__item {
116+
flex: 1;
117+
@include flex;
118+
justify-content: center;
119+
120+
&__content {
121+
@include flex;
122+
align-items: center;
123+
}
124+
}
125+
}
126+
}
146127
</style>

0 commit comments

Comments
 (0)