Skip to content

Commit 5270afd

Browse files
committed
1. 【优化】配置popup组件的外层元素z-index可动态调整
2. 【优化】select和picker组件在微信小程序上第二次打开,直接点确定返回可能不对的问题 3. 【优化】添加u-col的click事件 4. 【修复】修复image组件无需淡入效果时png图片能看到底色的问题 5. 【修复】修复checkbox的lable-disabled参数无效的问题
1 parent 2587cd1 commit 5270afd

File tree

13 files changed

+147
-48
lines changed

13 files changed

+147
-48
lines changed

pages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// "current": 0, //当前激活的模式(list 的索引项)
77
// "list": [{
88
// "name": "test", //模式名称
9-
// "path": "pages/componentsB/tabbar/index", //启动页面,必选
9+
// "path": "pages/componentsA/select/index", //启动页面,必选
1010
// "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
1111
// }]
1212
// },

pages/componentsB/picker/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default {
116116
this.show = true;
117117
},
118118
confirm(e) {
119-
console.log(e);
119+
// console.log(e);
120120
this.input = '';
121121
if (this.mode == 'time') {
122122
if (this.params.year) this.input += e.year;

pages/componentsB/tabbar/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@
113113
},
114114
badgeChange(index) {
115115
if (index == 1) {
116-
this.config[0].count = 0;
117-
this.config[4].count = 0;
116+
this.list[0].count = 0;
117+
this.list[4].count = 0;
118118
} else {
119-
this.config[0].count = 2;
120-
this.config[4].count = 23;
119+
this.list[0].count = 2;
120+
this.list[4].count = 23;
121121
}
122122
},
123123
minButtonChange(index) {

pages/componentsC/test/index.vue

Lines changed: 101 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,109 @@
11
<template>
2-
<view class="wrap">
3-
<u-swiper :list="list"></u-swiper>
2+
<view>
3+
<u-select v-model="show" @confirm="confirm" :list="list"></u-select>
4+
<u-button @click="show = true">打开</u-button>
45
</view>
56
</template>
67

78
<script>
8-
export default {
9-
data() {
10-
return {
11-
list: [{
12-
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
13-
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
14-
},
15-
{
16-
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
17-
title: '身无彩凤双飞翼,心有灵犀一点通'
18-
},
19-
{
20-
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
21-
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
9+
export default {
10+
data() {
11+
return {
12+
show: false,
13+
list: [
14+
{
15+
label: '测试',
16+
value: 'b0da629fa36e32110ea86dbfc53db96a',
17+
extra: {
18+
ductId: 'b0da629fa36e32110ea86dbfc53db96a',
19+
name: '测试',
20+
type: 3,
21+
imgUrl: '1594173070713.jpg',
22+
effectiveDay: 4,
23+
dateType: 'day',
24+
isInlay: 1,
25+
createTime: '2020-07-08 09:51:13',
26+
printerNum: 3,
27+
createBy: '1',
28+
updateTime: '2020-07-08 09:51:13',
29+
updateBy: null,
30+
ductAccessoryInfoList: []
2231
}
23-
],
24-
}
25-
},
26-
methods: {
27-
32+
},
33+
{
34+
label: 'PICC - 2类',
35+
value: '1c0c70fafe74e840dc79f1bfe2833b2b',
36+
extra: {
37+
ductId: '1c0c70fafe74e840dc79f1bfe2833b2b',
38+
name: 'PICC - 2类',
39+
type: 3,
40+
imgUrl: '1592987125427.jpeg',
41+
effectiveDay: 7,
42+
dateType: 'day',
43+
isInlay: 1,
44+
createTime: '2020-06-24 16:25:25',
45+
printerNum: 1,
46+
createBy: '1',
47+
updateTime: '2020-07-09 12:01:02',
48+
updateBy: null,
49+
ductAccessoryInfoList: [
50+
{
51+
ductAccessoryId: 'aecdc0e314dcb346a5ec1838929c02e6',
52+
name: '敷贴 - 2类',
53+
type: 1,
54+
imgUrl: '',
55+
effectiveDay: 3,
56+
createTime: '2020-06-24 16:26:01',
57+
createBy: '1',
58+
updateTime: '2020-07-09 12:02:25',
59+
dateType: 'day',
60+
updateBy: null,
61+
ductId: '1c0c70fafe74e840dc79f1bfe2833b2b',
62+
printerNum: 2
63+
},
64+
{
65+
ductAccessoryId: 'cea78c669259529a6e66cd0d3b7ea357',
66+
name: '敷贴 - 1类',
67+
type: 1,
68+
imgUrl: '1592987145754.jpeg',
69+
effectiveDay: 7,
70+
createTime: '2020-06-24 16:25:46',
71+
createBy: '1',
72+
updateTime: '2020-07-09 12:04:29',
73+
dateType: 'day',
74+
updateBy: null,
75+
ductId: '1c0c70fafe74e840dc79f1bfe2833b2b',
76+
printerNum: 2
77+
}
78+
]
79+
}
80+
},
81+
{
82+
label: 'PICC - 1类',
83+
value: '903a262182003743bb3062fe7393ffbd',
84+
extra: {
85+
ductId: '903a262182003743bb3062fe7393ffbd',
86+
name: 'PICC - 1类',
87+
type: 3,
88+
imgUrl: '1592987111641.jpeg',
89+
effectiveDay: 56,
90+
dateType: 'hour',
91+
isInlay: 1,
92+
createTime: '2020-06-24 16:25:12',
93+
printerNum: 1,
94+
createBy: '1',
95+
updateTime: '2020-07-09 14:24:02',
96+
updateBy: null,
97+
ductAccessoryInfoList: []
98+
}
99+
}
100+
]
101+
};
102+
},
103+
methods: {
104+
confirm(e) {
105+
console.log(e);
28106
}
29107
}
30-
</script>
108+
};
109+
</script>

uview-ui/components/u-checkbox/u-checkbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
},
161161
methods: {
162162
onClickLabel() {
163-
if (!this.isDisabled) {
163+
if (!this.isLabelDisabled) {
164164
this.setValue();
165165
}
166166
},

uview-ui/components/u-col/u-col.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
flex: `0 0 ${100 / 12 * span}%`,
88
alignItems: uAlignItem,
99
justifyContent: uJustify
10-
}">
10+
}" @tap.stop.prevent="click">
1111
<slot></slot>
1212
</view>
1313
</template>
@@ -58,6 +58,11 @@
5858
else return this.align;
5959
}
6060
},
61+
methods: {
62+
click() {
63+
this.$emit('click');
64+
}
65+
}
6166
}
6267
</script>
6368

uview-ui/components/u-field/u-field.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
:type="type"
2424
class="u-flex-1 u-field__input-wrap"
2525
:value="value"
26-
:password="password || type === 'password'"
26+
:password="type === 'password' ? 'text' : type"
2727
:placeholder="placeholder"
2828
:placeholderStyle="placeholderStyle"
2929
:disabled="disabled"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* @property {String} label-pos label文字相对于图标的位置,只能right或bottom(默认right)
2727
* @property {String} label-color label字体颜色(默认#606266)
2828
* @property {Object} custom-style icon的样式,对象形式
29+
* @property {String} custom-prefix 自定义字体图标库时,需要写上此值
2930
* @property {String | Number} margin-left label在右侧时与图标的距离,单位rpx(默认6)
3031
* @property {String | Number} margin-top label在下方时与图标的距离,单位rpx(默认6)
3132
* @property {String | Number} margin-bottom label在上方时与图标的距离,单位rpx(默认6)
@@ -160,6 +161,7 @@ export default {
160161
imgStyle() {
161162
let style = {};
162163
style.width = this.$u.addUnit(this.size);
164+
style.height = this.$u.addUnit(this.size);
163165
return style;
164166
}
165167
},

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ export default {
157157
this.loading = false;
158158
this.isError = false;
159159
this.$emit('load');
160-
// 如果不需要动画效果,就不执行下方代码
161-
if(!this.fade) return ;
160+
// 如果不需要动画效果,就不执行下方代码,同时移除加载时的背景颜色
161+
// 否则无需fade效果时,png图片依然能看到下方的背景色
162+
if(!this.fade) return this.removeBgColor();
162163
// 原来opacity为1(不透明,是为了显示占位图),改成0(透明,意味着该元素显示的是背景颜色,默认的灰色),再改成1,是为了获得过渡效果
163164
this.opacity = 0;
164165
// 这里设置为0,是为了图片展示到背景全透明这个过程时间为0,延时之后延时之后重新设置为duration,是为了获得背景透明(灰色)
@@ -169,12 +170,16 @@ export default {
169170
this.durationTime = this.duration;
170171
this.opacity = 1;
171172
setTimeout(() => {
172-
// 淡入动画过渡完成后,将背景设置为透明色,否则png图片会看到灰色的背景
173-
this.backgroundStyle = {
174-
backgroundColor: 'transparent'
175-
};
173+
this.removeBgColor();
176174
}, this.durationTime)
177175
}, 50)
176+
},
177+
// 移除图片的背景色
178+
removeBgColor() {
179+
// 淡入动画过渡完成后,将背景设置为透明色,否则png图片会看到灰色的背景
180+
this.backgroundStyle = {
181+
backgroundColor: 'transparent'
182+
};
178183
}
179184
}
180185
};

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
3-
<view class="u-datetime-picker" @tap.stop>
3+
<!-- 多加一个if判断,避免微信小程序第二次打开后,视图没有重新渲染,而导致数据混乱 -->
4+
<view class="u-datetime-picker" @tap.stop v-if="value">
45
<view class="u-picker-header" @touchmove.stop.prevent="">
56
<view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }" hover-class="u-opacity" :hover-stay-time="150" @tap="getResult('cancel')">取消</view>
67
<view class="u-picker__title">{{ title }}</view>
@@ -562,7 +563,7 @@ export default {
562563
},
563564
// 获取时间戳
564565
getTimestamp() {
565-
let time = this.year + '-' + this.month + '-' + this.day + ' ' + this.day + ':' + this.minute + ':' + this.second;
566+
let time = this.year + '-' + this.month + '-' + this.day + ' ' + this.hour + ':' + this.minute + ':' + this.second;
566567
return new Date(time).getTime() / 1000;
567568
}
568569
}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
2-
<view v-if="visibleSync" :style="[customStyle]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer">
2+
<view v-if="visibleSync" :style="[customStyle, {
3+
zIndex: uZindex - 1
4+
}]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer">
35
<u-mask :maskClickAble="maskCloseAble" :show="showDrawer && mask" @click="maskClick"></u-mask>
46
<view
57
class="u-drawer-content"
@@ -207,7 +209,7 @@ export default {
207209
transform: `translate3D(0px,${this.mode == 'top' ? '-100%' : '100%'},0px)`
208210
};
209211
}
210-
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
212+
style.zIndex = this.uZindex;
211213
// 如果用户设置了borderRadius值,添加弹窗的圆角
212214
if (this.borderRadius) {
213215
switch (this.mode) {
@@ -236,7 +238,7 @@ export default {
236238
style.width = this.width ? this.getUnitValue(this.width) : this.getUnitValue(this.length);
237239
// 中部弹出的模式,如果没有设置高度,就用auto值,由内容撑开高度
238240
style.height = this.height ? this.getUnitValue(this.height) : 'auto';
239-
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.popup;
241+
style.zIndex = this.uZindex;
240242
style.marginTop = `-${this.$u.addUnit(this.negativeTop)}`;
241243
if (this.borderRadius) {
242244
style.borderRadius = `${this.borderRadius}rpx`;
@@ -245,6 +247,10 @@ export default {
245247
}
246248
return style;
247249
},
250+
// 计算整理后的z-index值
251+
uZindex() {
252+
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
253+
}
248254
},
249255
watch: {
250256
value(val) {
@@ -324,7 +330,6 @@ export default {
324330
right: 0;
325331
bottom: 0;
326332
overflow: hidden;
327-
z-index: 999;
328333
}
329334
330335
.u-drawer-content {

uview-ui/components/u-select/u-select.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
</view>
1111
</view> -->
1212
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
13-
<view class="u-select">
13+
<!-- 多加一个if判断,避免微信小程序第二次打开后,视图没有重新渲染,而导致数据混乱 -->
14+
<view class="u-select" v-if="value">
1415
<view class="u-select__header" @touchmove.stop.prevent="">
1516
<view
1617
class="u-select__header__cancel u-select__header__btn"
@@ -251,12 +252,13 @@ export default {
251252
let tmp = null;
252253
for(let i = 0; i < this.columnNum; i++) {
253254
tmp = this.columnData[i][this.defaultSelector[i]];
254-
this.selectValue.push({
255+
let data = {
255256
value: tmp ? tmp[this.valueName] : null,
256257
label: tmp ? tmp[this.labelName] : null
257-
})
258+
};
258259
// 判断是否存在额外的参数,如果存在,就返回
259-
if(tmp && tmp.extra) this.selectValue.extra = tmp.extra;
260+
if(tmp && tmp.extra) data.extra = tmp.extra;
261+
this.selectValue.push(data)
260262
}
261263
},
262264
// 列选项

uview-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uview-ui",
3-
"version": "1.4.8",
3+
"version": "1.5.0",
44
"description": "uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
55
"main": "index.js",
66
"keywords": ["uview", "uView", "uni-app", "uni-app ui", "uniapp", "uviewui", "uview ui", "uviewUI", "uViewui", "uViewUI", "uView UI", "uni ui", "uni UI", "uniapp ui", "ui", "UI框架", "uniapp ui框架", "uniapp UI"],

0 commit comments

Comments
 (0)