uview-plus 3.1.51 → 3.2.3
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 +47 -0
- package/components/u-action-sheet/u-action-sheet.vue +1 -1
- package/components/u-album/u-album.vue +261 -261
- package/components/u-avatar/u-avatar.vue +3 -2
- package/components/u-avatar-group/u-avatar-group.vue +106 -106
- package/components/u-button/u-button.vue +12 -7
- package/components/u-calendar/u-calendar.vue +4 -3
- package/components/u-cell/u-cell.vue +6 -3
- package/components/u-checkbox/props.js +5 -0
- package/components/u-checkbox/u-checkbox.vue +27 -15
- package/components/u-code/u-code.vue +1 -1
- package/components/u-copy/u-copy.vue +70 -0
- package/components/u-dropdown/props.js +8 -14
- package/components/u-dropdown/u-dropdown.vue +202 -77
- package/components/u-dropdown-item/props.js +45 -36
- package/components/u-dropdown-item/u-dropdown-item.vue +121 -148
- package/components/u-form/u-form.vue +1 -1
- package/components/u-form-item/props.js +6 -1
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-gap/u-gap.vue +5 -4
- package/components/u-grid/u-grid.vue +4 -2
- package/components/u-grid-item/u-grid-item.vue +8 -7
- package/components/u-input/u-input.vue +1 -1
- package/components/u-lazy-load/u-lazy-load.vue +251 -0
- package/components/u-picker/u-picker.vue +4 -1
- package/components/u-popup/u-popup.vue +1 -1
- package/components/u-read-more/u-read-more.vue +164 -160
- package/components/u-slider/u-slider.vue +6 -6
- package/components/u-steps-item/u-steps-item.vue +318 -318
- package/components/u-subsection/u-subsection.vue +14 -8
- package/components/u-swiper/u-swiper.vue +6 -8
- package/components/u-tabs/u-tabs.vue +1 -0
- package/components/u-tag/props.js +5 -2
- package/components/u-text/u-text.vue +226 -226
- package/components/u-textarea/u-textarea.vue +275 -275
- package/components/u-transition/u-transition.vue +1 -1
- package/components/u-waterfall/u-waterfall.vue +225 -0
- package/index.js +5 -1
- package/libs/config/props/formItem.js +1 -0
- package/libs/config/props/tag.js +30 -29
- package/libs/css/common.scss +1 -1
- package/libs/css/components.scss +5 -5
- package/libs/function/colorGradient.js +8 -8
- package/libs/function/debounce.js +2 -2
- package/libs/function/digit.js +5 -5
- package/libs/function/index.js +29 -29
- package/libs/function/test.js +28 -28
- package/libs/function/throttle.js +2 -2
- package/libs/mixin/mixin.js +2 -2
- package/package.json +2 -2
|
@@ -1,148 +1,121 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="u-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
31
|
-
* @
|
|
32
|
-
* @property {String}
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.animationData = animation.export()
|
|
123
|
-
// 标识动画结束
|
|
124
|
-
uni.$u.sleep(this.duration).then(() => {
|
|
125
|
-
this.animating = false
|
|
126
|
-
})
|
|
127
|
-
// #endif
|
|
128
|
-
},
|
|
129
|
-
overlayClick() {
|
|
130
|
-
this.show = false
|
|
131
|
-
this.setContentAnimate(0)
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
}
|
|
135
|
-
</script>
|
|
136
|
-
|
|
137
|
-
<style lang="scss" scoped>
|
|
138
|
-
@import '../../libs/css/components.scss';
|
|
139
|
-
|
|
140
|
-
.u-drawdown-item {
|
|
141
|
-
|
|
142
|
-
&__content {
|
|
143
|
-
background-color: #FFFFFF;
|
|
144
|
-
overflow: hidden;
|
|
145
|
-
height: 0;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent="() => {}" @tap.stop.prevent="() => {}">
|
|
3
|
+
<block v-if="!$slots.default && !$slots.$default">
|
|
4
|
+
<scroll-view scroll-y="true" :style="{
|
|
5
|
+
height: $u.addUnit(height)
|
|
6
|
+
}">
|
|
7
|
+
<view class="u-dropdown-item__options">
|
|
8
|
+
<up-cell-group>
|
|
9
|
+
<up-cell @click="cellClick(item.value)" :arrow="false" :title="item.label" v-for="(item, index) in options"
|
|
10
|
+
:key="index" :title-style="{
|
|
11
|
+
color: modelValue == item.value ? activeColor : inactiveColor
|
|
12
|
+
}">
|
|
13
|
+
<up-icon v-if="modelValue == item.value" name="checkbox-mark" :color="activeColor" size="32"></up-icon>
|
|
14
|
+
</up-cell>
|
|
15
|
+
</up-cell-group>
|
|
16
|
+
</view>
|
|
17
|
+
</scroll-view>
|
|
18
|
+
</block>
|
|
19
|
+
<slot v-else />
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import props from './props.js';
|
|
25
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
26
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
27
|
+
/**
|
|
28
|
+
* dropdown-item 下拉菜单
|
|
29
|
+
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
30
|
+
* @tutorial https://ijry.github.io/uview-plus/components/dropdown.html
|
|
31
|
+
* @property {String | Number} v-model 双向绑定选项卡选择值
|
|
32
|
+
* @property {String} title 菜单项标题
|
|
33
|
+
* @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
|
|
34
|
+
* @property {Boolean} disabled 是否禁用此选项卡(默认false)
|
|
35
|
+
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
|
|
36
|
+
* @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
|
|
37
|
+
* @example <u-dropdown-item title="标题"></u-dropdown-item>
|
|
38
|
+
*/
|
|
39
|
+
export default {
|
|
40
|
+
name: 'u-dropdown-item',
|
|
41
|
+
mixins: [mpMixin, mixin, props],
|
|
42
|
+
options: {
|
|
43
|
+
styleIsolation: 'shared',
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
active: false, // 当前项是否处于展开状态
|
|
48
|
+
activeColor: '#2979ff', // 激活时左边文字和右边对勾图标的颜色
|
|
49
|
+
inactiveColor: '#606266', // 未激活时左边文字和右边对勾图标的颜色
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
// 监听props是否发生了变化,有些值需要传递给父组件u-dropdown,无法双向绑定
|
|
54
|
+
propsChange() {
|
|
55
|
+
return `${this.title}-${this.disabled}`;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
propsChange(n) {
|
|
60
|
+
// 当值变化时,通知父组件重新初始化,让父组件执行每个子组件的init()方法
|
|
61
|
+
// 将所有子组件数据重新整理一遍
|
|
62
|
+
if (this.parent) this.parent.init();
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
created() {
|
|
66
|
+
// 父组件的实例
|
|
67
|
+
this.parent = false;
|
|
68
|
+
},
|
|
69
|
+
emits: ['update:modelValue', 'change'],
|
|
70
|
+
methods: {
|
|
71
|
+
init() {
|
|
72
|
+
// 获取父组件u-dropdown
|
|
73
|
+
let parent = this.$u.$parent.call(this, 'u-dropdown');
|
|
74
|
+
if (parent) {
|
|
75
|
+
this.parent = parent;
|
|
76
|
+
// 将子组件的激活颜色配置为父组件设置的激活和未激活时的颜色
|
|
77
|
+
this.activeColor = parent.activeColor;
|
|
78
|
+
this.inactiveColor = parent.inactiveColor;
|
|
79
|
+
// 将本组件的this,放入到父组件的children数组中,让父组件可以操作本(子)组件的方法和属性
|
|
80
|
+
// push进去前,显判断是否已经存在了本实例,因为在子组件内部数据变化时,会通过父组件重新初始化子组件
|
|
81
|
+
let exist = parent.children.find(val => {
|
|
82
|
+
return this === val;
|
|
83
|
+
})
|
|
84
|
+
if (!exist) parent.children.push(this);
|
|
85
|
+
if (parent.children.length == 1) this.active = true;
|
|
86
|
+
// 父组件无法监听children的变化,故将子组件的title,传入父组件的menuList数组中
|
|
87
|
+
parent.menuList.push({
|
|
88
|
+
title: this.title,
|
|
89
|
+
disabled: this.disabled
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
// cell被点击
|
|
94
|
+
cellClick(value) {
|
|
95
|
+
// 修改通过v-model绑定的值
|
|
96
|
+
// #ifdef VUE2
|
|
97
|
+
this.$emit('input', value);
|
|
98
|
+
// #endif
|
|
99
|
+
// #ifdef VUE3
|
|
100
|
+
this.$emit('update:modelValue', value);
|
|
101
|
+
// #endif
|
|
102
|
+
// 通知父组件(u-dropdown)收起菜单
|
|
103
|
+
this.parent.close();
|
|
104
|
+
// 发出事件,抛出当前勾选项的value
|
|
105
|
+
this.$emit('change', value);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
mounted() {
|
|
109
|
+
this.init();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style scoped lang="scss">
|
|
115
|
+
@import "../../libs/css/components.scss";
|
|
116
|
+
.u-dropdown-item__options {
|
|
117
|
+
::v-deep .u-cell-group {
|
|
118
|
+
background: #ffffff;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @property {String | Number} labelWidth 提示文字的宽度,单位px ( 默认 45 )
|
|
24
24
|
* @property {String} labelAlign lable字体的对齐方式 ( 默认 ‘left' )
|
|
25
25
|
* @property {Object} labelStyle lable的样式,对象形式
|
|
26
|
-
* @example <
|
|
26
|
+
* @example <up-formlabelPosition="left" :model="model1" :rules="rules" ref="form1"></up-form>
|
|
27
27
|
*/
|
|
28
28
|
export default {
|
|
29
29
|
name: "u-form",
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
default: () => uni.$u.props.formItem.prop
|
|
12
12
|
},
|
|
13
13
|
// 绑定的规则
|
|
14
|
-
|
|
14
|
+
rule: {
|
|
15
15
|
type: String,
|
|
16
16
|
default: () => uni.$u.props.formItem.rule
|
|
17
17
|
},
|
|
@@ -20,6 +20,11 @@ export default {
|
|
|
20
20
|
type: [String, Boolean],
|
|
21
21
|
default: () => uni.$u.props.formItem.borderBottom
|
|
22
22
|
},
|
|
23
|
+
// label的位置,left-左边,top-上边
|
|
24
|
+
labelPosition: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: () => uni.$u.props.formItem.labelPosition
|
|
27
|
+
},
|
|
23
28
|
// label的宽度,单位px
|
|
24
29
|
labelWidth: {
|
|
25
30
|
type: [String, Number],
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class="u-form-item__body"
|
|
5
5
|
@tap="clickHandler"
|
|
6
6
|
:style="[$u.addStyle(customStyle), {
|
|
7
|
-
|
|
7
|
+
flexDirection: (labelPosition || parentData.labelPosition) === 'left' ? 'row' : 'column'
|
|
8
8
|
}]"
|
|
9
9
|
>
|
|
10
10
|
<!-- 微信小程序中,将一个参数设置空字符串,结果会变成字符串"true" -->
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import props from './props.js';
|
|
7
7
|
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
8
8
|
import mixin from '../../libs/mixin/mixin.js';
|
|
9
|
+
import { addStyle, addUnit, deepMerge } from '../../libs/function/index.js';
|
|
9
10
|
/**
|
|
10
11
|
* gap 间隔槽
|
|
11
12
|
* @description 该组件一般用于内容块之间的用一个灰色块隔开的场景,方便用户风格统一,减少工作量
|
|
@@ -25,11 +26,11 @@
|
|
|
25
26
|
gapStyle() {
|
|
26
27
|
const style = {
|
|
27
28
|
backgroundColor: this.bgColor,
|
|
28
|
-
height:
|
|
29
|
-
marginTop:
|
|
30
|
-
marginBottom:
|
|
29
|
+
height: addUnit(this.height),
|
|
30
|
+
marginTop: addUnit(this.marginTop),
|
|
31
|
+
marginBottom: addUnit(this.marginBottom),
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
};
|
|
@@ -71,7 +71,9 @@
|
|
|
71
71
|
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
emits: ['click'], // 防止事件执行两次
|
|
74
|
+
emits: ['click'], // 防止事件执行两次
|
|
75
|
+
// virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
|
|
76
|
+
},
|
|
75
77
|
methods: {
|
|
76
78
|
// 此方法由u-grid-item触发,用于在u-grid发出事件
|
|
77
79
|
childClick(name) {
|
|
@@ -95,6 +97,6 @@
|
|
|
95
97
|
justify-content: center;
|
|
96
98
|
@include flex;
|
|
97
99
|
flex-wrap: wrap;
|
|
98
|
-
align-items: center;
|
|
100
|
+
align-items: center;
|
|
99
101
|
}
|
|
100
102
|
</style>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<!-- #ifndef APP-NVUE -->
|
|
3
|
-
<view
|
|
4
|
-
v-if="parentData.col > 0"
|
|
2
|
+
<!-- #ifndef APP-NVUE -->
|
|
3
|
+
<view
|
|
5
4
|
class="u-grid-item"
|
|
6
5
|
hover-class="u-grid-item--hover-class"
|
|
7
6
|
:hover-stay-time="200"
|
|
@@ -50,6 +49,8 @@
|
|
|
50
49
|
},
|
|
51
50
|
// #ifdef APP-NVUE
|
|
52
51
|
width: 0, // nvue下才这么计算,vue下放到computed中,否则会因为延时造成闪烁
|
|
52
|
+
// #endif
|
|
53
|
+
width: '100%',
|
|
53
54
|
// #endif
|
|
54
55
|
classes: [], // 类名集合,用于判断是否显示右边和下边框
|
|
55
56
|
};
|
|
@@ -59,11 +60,11 @@
|
|
|
59
60
|
},
|
|
60
61
|
emits: ['click'],
|
|
61
62
|
// 微信小程序中 options 选项
|
|
62
|
-
|
|
63
|
-
virtualHost: true
|
|
64
|
-
},
|
|
63
|
+
// #ifdef MP-WEIXIN
|
|
64
|
+
virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
|
|
65
|
+
},
|
|
65
66
|
computed: {
|
|
66
|
-
// #ifndef APP-NVUE
|
|
67
|
+
// #ifndef APP-NVUE || MP-TOUTIAO
|
|
67
68
|
// vue下放到computed中,否则会因为延时造成闪烁
|
|
68
69
|
width() {
|
|
69
70
|
if (this.parentData.col > 0) {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
:adjust-position="adjustPosition"
|
|
38
38
|
:selection-end="selectionEnd"
|
|
39
39
|
:selection-start="selectionStart"
|
|
40
|
-
:password="password || type === 'password' ||
|
|
40
|
+
:password="password || type === 'password' || false"
|
|
41
41
|
:ignoreCompositionEvent="ignoreCompositionEvent"
|
|
42
42
|
@input="onInput"
|
|
43
43
|
@blur="onBlur"
|