Skip to content

Commit 15c1f04

Browse files
committed
更新:uView
1 parent 5c5988c commit 15c1f04

File tree

37 files changed

+554
-14296
lines changed

37 files changed

+554
-14296
lines changed

src/uview-ui/components/u-avatar/u-avatar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class="u-avatar__img"
77
v-if="!uText && avatar"
88
:src="avatar"
9-
:mode="mode"
9+
:mode="imgMode"
1010
></image>
1111
<text class="u-line-1" v-else-if="uText" :style="{
1212
fontSize: '38rpx'

src/uview-ui/components/u-button/u-button.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
hairLine ? showHairLineBorder : 'u-btn--bold-border',
1111
'u-btn--' + type,
1212
disabled ? `u-btn--${type}--disabled` : '',
13-
1413
]"
1514
:disabled="disabled"
1615
:form-type="formType"
@@ -29,7 +28,9 @@
2928
@error="error"
3029
@opensetting="opensetting"
3130
@launchapp="launchapp"
32-
:style="[customStyle]"
31+
:style="[customStyle, {
32+
overflow: ripple ? 'hidden' : 'visible'
33+
}]"
3334
@tap.stop="click($event)"
3435
:hover-class="getHoverClass"
3536
:loading="loading"
@@ -339,7 +340,8 @@ export default {
339340
border: 0;
340341
//border-radius: 10rpx;
341342
display: inline-block;
342-
overflow: hidden;
343+
// 避免边框某些场景可能被“裁剪”,不能设置为hidden
344+
overflow: visible;
343345
line-height: 1;
344346
display: flex;
345347
align-items: center;

src/uview-ui/components/u-card/u-card.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
:class="{ 'u-border': border, 'u-card-full': full, 'u-card--border': borderRadius > 0 }"
66
:style="{
77
borderRadius: borderRadius + 'rpx',
8-
margin: margin
8+
margin: margin,
9+
boxShadow: boxShadow
910
}"
1011
>
1112
<view
@@ -83,6 +84,7 @@
8384
* @property {String | Number} sub-title-size 副标题字体大小(默认26)
8485
* @property {Boolean} border 是否显示边框(默认true)
8586
* @property {String | Number} index 用于标识点击了第几个卡片
87+
* @property {String} box-shadow 卡片外围阴影,字符串形式(默认none)
8688
* @property {String} margin 卡片与屏幕两边和上下元素的间距,需带单位,如"30rpx 20rpx"(默认30rpx)
8789
* @property {String | Number} border-radius 卡片整体的圆角值,单位rpx(默认16)
8890
* @property {Object} head-style 头部自定义样式,对象形式
@@ -219,6 +221,11 @@ export default {
219221
showFoot: {
220222
type: Boolean,
221223
default: true
224+
},
225+
// 卡片外围阴影,字符串形式
226+
boxShadow: {
227+
type: String,
228+
default: 'none'
222229
}
223230
},
224231
data() {

src/uview-ui/components/u-cell-item/u-cell-item.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
<block class="u-cell__value" v-if="value">{{ value }}</block>
3636
<slot v-else></slot>
3737
</view>
38-
<u-icon v-if="arrow" name="arrow-right" :style="[arrowStyle]" class="u-icon-wrap u-cell__right-icon-wrap"></u-icon>
3938
<view class="u-flex" v-if="$slots['right-icon']">
4039
<slot name="right-icon"></slot>
4140
</view>
41+
<u-icon v-if="arrow" name="arrow-right" :style="[arrowStyle]" class="u-icon-wrap u-cell__right-icon-wrap"></u-icon>
4242
</view>
4343
</template>
4444

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<style lang="scss">
7777
@import "../../libs/css/style.components.scss";
7878
.u-col {
79-
/* #ifdef MP-WEIXIN */
79+
/* #ifdef MP-WEIXIN || MP-QQ */
8080
float: left;
8181
/* #endif */
8282
}

src/uview-ui/components/u-count-down/u-count-down.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default {
164164
// 监听时间戳的变化
165165
timestamp(newVal, oldVal) {
166166
// 如果倒计时间发生变化,清除定时器,重新开始倒计时
167-
clearInterval(this.timer);
167+
this.clearTimer();
168168
this.start();
169169
}
170170
},
@@ -211,6 +211,8 @@ export default {
211211
methods: {
212212
// 倒计时
213213
start() {
214+
// 避免可能出现的倒计时重叠情况
215+
this.clearTimer();
214216
if (this.timestamp <= 0) return;
215217
this.seconds = Number(this.timestamp);
216218
this.formatTime(this.seconds);
@@ -254,10 +256,16 @@ export default {
254256
},
255257
// 停止倒计时
256258
end() {
257-
// 清除定时器
258-
clearInterval(this.timer);
259-
this.timer = null;
259+
this.clearTimer();
260260
this.$emit('end', {});
261+
},
262+
// 清除定时器
263+
clearTimer() {
264+
if(this.timer) {
265+
// 清除定时器
266+
clearInterval(this.timer);
267+
this.timer = null;
268+
}
261269
}
262270
},
263271
beforeDestroy() {
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<template>
2+
<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent @tap.stop.prevent>
3+
<view class="u-dropdown-item__options" v-if="!$slots.default">
4+
<u-cell-group>
5+
<u-cell-item @click="cellClick(item.value)" :arrow="false" :title="item.label" v-for="(item, index) in options" :key="index" :title-style="{
6+
color: value == item.value ? activeColor : inactiveColor
7+
}">
8+
<u-icon v-if="value == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
9+
</u-cell-item>
10+
</u-cell-group>
11+
</view>
12+
<slot v-else />
13+
</view>
14+
</template>
15+
16+
<script>
17+
export default {
18+
name: 'u-dropdown-item',
19+
props: {
20+
// 当前选中项的value值
21+
value: {
22+
type: [Number, String, Array],
23+
default: ''
24+
},
25+
// 菜单项标题
26+
title: {
27+
type: [String, Number],
28+
default: ''
29+
},
30+
// 选项数据,如果传入了默认slot,此参数无效
31+
options: {
32+
type: Array,
33+
default () {
34+
return []
35+
}
36+
},
37+
// 是否禁用此菜单项
38+
disabled: {
39+
type: Boolean,
40+
default: false
41+
},
42+
},
43+
data() {
44+
return {
45+
active: false, // 当前项是否处于展开状态
46+
activeColor: '#2979ff', // 激活时左边文字和右边对勾图标的颜色
47+
inactiveColor: '#606266', // 未激活时左边文字和右边对勾图标的颜色
48+
}
49+
},
50+
computed: {
51+
// 监听props是否发生了变化,有些值需要传递给父组件u-dropdown,无法双向绑定
52+
propsChange() {
53+
return `${this.title}-${this.disabled}`;
54+
}
55+
},
56+
watch: {
57+
propsChange(n) {
58+
// 当值变化时,通知父组件重新初始化,让父组件执行每个子组件的init()方法
59+
// 将所有子组件数据重新整理一遍
60+
if(this.parent) this.parent.init();
61+
}
62+
},
63+
created() {
64+
// 父组件的实例
65+
this.parent = false;
66+
},
67+
methods: {
68+
init() {
69+
// 获取父组件u-dropdown
70+
let parent = this.$u.$parent.call(this, 'u-dropdown');
71+
if(parent) {
72+
this.parent = parent;
73+
// 将子组件的激活颜色配置为父组件设置的激活和未激活时的颜色
74+
this.activeColor = parent.activeColor;
75+
this.inactiveColor = parent.inactiveColor;
76+
// 将本组件的this,放入到父组件的children数组中,让父组件可以操作本(子)组件的方法和属性
77+
parent.children.push(this);
78+
if(parent.children.length == 1) this.active = true;
79+
// 父组件无法监听children的变化,故将子组件的title,传入父组件的menuList数组中
80+
parent.menuList.push({
81+
title: this.title,
82+
disabled: this.disabled
83+
});
84+
}
85+
},
86+
// cell被点击
87+
cellClick(value) {
88+
// 修改通过v-model绑定的值
89+
this.$emit('input', value);
90+
// 通知父组件(u-dropdown)收起菜单
91+
this.parent.close();
92+
// 发出事件,抛出当前勾选项的value
93+
this.$emit('change', value);
94+
}
95+
},
96+
mounted() {
97+
this.init();
98+
}
99+
}
100+
</script>
101+
102+
<style scoped lang="scss">
103+
@import "../../libs/css/style.components.scss";
104+
</style>

0 commit comments

Comments
 (0)