uview-plus 3.1.36 → 3.1.37
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 +2 -0
- package/components/u-action-sheet/u-action-sheet.vue +1 -0
- package/components/u-album/u-album.vue +1 -0
- package/components/u-alert/u-alert.vue +1 -0
- package/components/u-avatar/u-avatar.vue +1 -0
- package/components/u-avatar-group/u-avatar-group.vue +1 -0
- package/components/u-back-top/u-back-top.vue +2 -1
- package/components/u-badge/u-badge.vue +1 -1
- package/components/u-calendar/u-calendar.vue +1 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +312 -311
- package/components/u-cell/u-cell.vue +1 -1
- package/components/u-cell-group/u-cell-group.vue +1 -1
- package/components/u-checkbox/u-checkbox.vue +2 -1
- package/components/u-code/u-code.vue +1 -0
- package/components/u-code-input/props.js +13 -5
- package/components/u-code-input/u-code-input.vue +8 -2
- package/components/u-col/u-col.vue +1 -0
- package/components/u-collapse/u-collapse.vue +1 -0
- package/components/u-column-notice/u-column-notice.vue +1 -0
- package/components/u-count-down/u-count-down.vue +164 -163
- package/components/u-count-to/u-count-to.vue +1 -0
- package/components/u-divider/u-divider.vue +1 -0
- package/components/u-dropdown/u-dropdown.vue +127 -129
- package/components/u-form-item/u-form-item.vue +1 -0
- package/components/u-image/u-image.vue +1 -1
- package/components/u-index-anchor/u-index-anchor.vue +1 -1
- package/components/u-index-item/u-index-item.vue +1 -1
- package/components/u-index-list/u-index-list.vue +1 -1
- package/components/u-input/u-input.vue +3 -3
- package/components/u-keyboard/u-keyboard.vue +1 -0
- package/components/u-link/u-link.vue +1 -0
- package/components/u-list/u-list.vue +1 -0
- package/components/u-loadmore/u-loadmore.vue +1 -0
- package/components/u-modal/u-modal.vue +230 -229
- package/components/u-navbar/u-navbar.vue +1 -1
- package/components/u-no-network/u-no-network.vue +1 -0
- package/components/u-notice-bar/u-notice-bar.vue +1 -0
- package/components/u-number-box/u-number-box.vue +1 -1
- package/components/u-number-keyboard/u-number-keyboard.vue +1 -1
- package/components/u-overlay/u-overlay.vue +1 -0
- package/components/u-parse/node/node.vue +2 -2
- package/components/u-parse/parser.js +1333 -1333
- package/components/u-parse/u-parse.vue +3 -3
- package/components/u-popup/u-popup.vue +307 -306
- package/components/u-radio/u-radio.vue +1 -1
- package/components/u-read-more/u-read-more.vue +1 -0
- package/components/u-row/u-row.vue +1 -0
- package/components/u-row-notice/u-row-notice.vue +1 -0
- package/components/u-scroll-list/u-scroll-list.vue +1 -0
- package/components/u-search/u-search.vue +6 -2
- package/components/u-slider/props.js +13 -5
- package/components/u-slider/u-slider.vue +66 -55
- package/components/u-status-bar/u-status-bar.vue +1 -1
- package/components/u-steps/u-steps.vue +1 -1
- package/components/u-steps-item/u-steps-item.vue +1 -1
- package/components/u-subsection/u-subsection.vue +1 -0
- package/components/u-swiper/u-swiper.vue +10 -9
- package/components/u-tabbar-item/u-tabbar-item.vue +1 -0
- package/components/u-tag/u-tag.vue +362 -361
- package/components/u-toolbar/u-toolbar.vue +1 -0
- package/components/u-tooltip/u-tooltip.vue +1 -0
- package/components/u-upload/u-upload.vue +1 -1
- package/package.json +1 -1
|
@@ -31,11 +31,19 @@ export default {
|
|
|
31
31
|
type: [String, Number],
|
|
32
32
|
default: defprops.codeInput.space
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// #ifdef VUE3
|
|
35
|
+
// 预置值
|
|
36
|
+
modelValue: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: defprops.codeInput.value
|
|
39
|
+
},
|
|
40
|
+
// #endif
|
|
41
|
+
// #ifdef VUE2
|
|
42
|
+
// 预置值
|
|
43
|
+
value: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: defprops.codeInput.value
|
|
46
|
+
},
|
|
39
47
|
// 是否自动获取焦点
|
|
40
48
|
focus: {
|
|
41
49
|
type: Boolean,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
import mixin from '../../libs/mixin/mixin.js';
|
|
52
52
|
/**
|
|
53
53
|
* CodeInput 验证码输入
|
|
54
|
-
* @description 该组件一般用于验证用户短信验证码的场景,也可以结合
|
|
54
|
+
* @description 该组件一般用于验证用户短信验证码的场景,也可以结合uview-plus的键盘组件使用
|
|
55
55
|
* @tutorial https://ijry.github.io/uview-plus/components/codeInput.html
|
|
56
56
|
* @property {String | Number} maxlength 最大输入长度 (默认 6 )
|
|
57
57
|
* @property {Boolean} dot 是否用圆点填充 (默认 false )
|
|
@@ -149,6 +149,7 @@
|
|
|
149
149
|
return style
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
+
emits: ["change", 'finish', "update:modelValue"],
|
|
152
153
|
methods: {
|
|
153
154
|
// 监听输入框的值发生变化
|
|
154
155
|
inputHandler(e) {
|
|
@@ -163,7 +164,12 @@
|
|
|
163
164
|
// 未达到maxlength之前,发送change事件,达到后发送finish事件
|
|
164
165
|
this.$emit('change', value)
|
|
165
166
|
// 修改通过v-model双向绑定的值
|
|
166
|
-
|
|
167
|
+
// #ifdef VUE3
|
|
168
|
+
this.$emit("update:modelValue", value);
|
|
169
|
+
// #endif
|
|
170
|
+
// #ifdef VUE2
|
|
171
|
+
this.$emit("input", value);
|
|
172
|
+
// #endif
|
|
167
173
|
// 达到用户指定输入长度时,发出完成事件
|
|
168
174
|
if (String(value).length >= Number(this.maxlength)) {
|
|
169
175
|
this.$emit('finish', value)
|
|
@@ -1,165 +1,166 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="u-count-down">
|
|
3
|
-
<slot>
|
|
4
|
-
<text class="u-count-down__text">{{ formattedTime }}</text>
|
|
5
|
-
</slot>
|
|
6
|
-
</view>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-count-down">
|
|
3
|
+
<slot>
|
|
4
|
+
<text class="u-count-down__text">{{ formattedTime }}</text>
|
|
5
|
+
</slot>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
10
|
import props from './props.js';
|
|
11
11
|
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
12
|
-
import mixin from '../../libs/mixin/mixin.js';
|
|
13
|
-
import {
|
|
14
|
-
isSameSecond,
|
|
15
|
-
parseFormat,
|
|
16
|
-
parseTimeData
|
|
17
|
-
} from './utils';
|
|
18
|
-
/**
|
|
19
|
-
* u-count-down 倒计时
|
|
20
|
-
* @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
21
|
-
* @tutorial https://
|
|
22
|
-
* @property {String | Number} time 倒计时时长,单位ms (默认 0 )
|
|
23
|
-
* @property {String} format 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 (默认 'HH:mm:ss' )
|
|
24
|
-
* @property {Boolean} autoStart 是否自动开始倒计时 (默认 true )
|
|
25
|
-
* @property {Boolean} millisecond 是否展示毫秒倒计时 (默认 false )
|
|
26
|
-
* @event {Function} finish 倒计时结束时触发
|
|
27
|
-
* @event {Function} change 倒计时变化时触发
|
|
28
|
-
* @event {Function} start 开始倒计时
|
|
29
|
-
* @event {Function} pause 暂停倒计时
|
|
30
|
-
* @event {Function} reset 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
|
|
31
|
-
* @example <u-count-down :time="time"></u-count-down>
|
|
32
|
-
*/
|
|
33
|
-
export default {
|
|
34
|
-
name: 'u-count-down',
|
|
35
|
-
mixins: [mpMixin, mixin, props],
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
timer: null,
|
|
39
|
-
// 各单位(天,时,分等)剩余时间
|
|
40
|
-
timeData: parseTimeData(0),
|
|
41
|
-
// 格式化后的时间,如"03:23:21"
|
|
42
|
-
formattedTime: '0',
|
|
43
|
-
// 倒计时是否正在进行中
|
|
44
|
-
runing: false,
|
|
45
|
-
endTime: 0, // 结束的毫秒时间戳
|
|
46
|
-
remainTime: 0, // 剩余的毫秒时间
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
watch: {
|
|
50
|
-
time(n) {
|
|
51
|
-
this.reset()
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
mounted() {
|
|
55
|
-
this.init()
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
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
|
-
this
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this.
|
|
127
|
-
this.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.timer
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
$u-count-down-text-
|
|
156
|
-
$u-count-down-text-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
12
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
13
|
+
import {
|
|
14
|
+
isSameSecond,
|
|
15
|
+
parseFormat,
|
|
16
|
+
parseTimeData
|
|
17
|
+
} from './utils';
|
|
18
|
+
/**
|
|
19
|
+
* u-count-down 倒计时
|
|
20
|
+
* @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
21
|
+
* @tutorial https://uiadmin.net/uview-plus/components/countDown.html
|
|
22
|
+
* @property {String | Number} time 倒计时时长,单位ms (默认 0 )
|
|
23
|
+
* @property {String} format 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 (默认 'HH:mm:ss' )
|
|
24
|
+
* @property {Boolean} autoStart 是否自动开始倒计时 (默认 true )
|
|
25
|
+
* @property {Boolean} millisecond 是否展示毫秒倒计时 (默认 false )
|
|
26
|
+
* @event {Function} finish 倒计时结束时触发
|
|
27
|
+
* @event {Function} change 倒计时变化时触发
|
|
28
|
+
* @event {Function} start 开始倒计时
|
|
29
|
+
* @event {Function} pause 暂停倒计时
|
|
30
|
+
* @event {Function} reset 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
|
|
31
|
+
* @example <u-count-down :time="time"></u-count-down>
|
|
32
|
+
*/
|
|
33
|
+
export default {
|
|
34
|
+
name: 'u-count-down',
|
|
35
|
+
mixins: [mpMixin, mixin, props],
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
timer: null,
|
|
39
|
+
// 各单位(天,时,分等)剩余时间
|
|
40
|
+
timeData: parseTimeData(0),
|
|
41
|
+
// 格式化后的时间,如"03:23:21"
|
|
42
|
+
formattedTime: '0',
|
|
43
|
+
// 倒计时是否正在进行中
|
|
44
|
+
runing: false,
|
|
45
|
+
endTime: 0, // 结束的毫秒时间戳
|
|
46
|
+
remainTime: 0, // 剩余的毫秒时间
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
watch: {
|
|
50
|
+
time(n) {
|
|
51
|
+
this.reset()
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
mounted() {
|
|
55
|
+
this.init()
|
|
56
|
+
},
|
|
57
|
+
emits: ["change", "finish"],
|
|
58
|
+
methods: {
|
|
59
|
+
init() {
|
|
60
|
+
this.reset()
|
|
61
|
+
},
|
|
62
|
+
// 开始倒计时
|
|
63
|
+
start() {
|
|
64
|
+
if (this.runing) return
|
|
65
|
+
// 标识为进行中
|
|
66
|
+
this.runing = true
|
|
67
|
+
// 结束时间戳 = 此刻时间戳 + 剩余的时间
|
|
68
|
+
this.endTime = Date.now() + this.remainTime
|
|
69
|
+
this.toTick()
|
|
70
|
+
},
|
|
71
|
+
// 根据是否展示毫秒,执行不同操作函数
|
|
72
|
+
toTick() {
|
|
73
|
+
if (this.millisecond) {
|
|
74
|
+
this.microTick()
|
|
75
|
+
} else {
|
|
76
|
+
this.macroTick()
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
macroTick() {
|
|
80
|
+
this.clearTimeout()
|
|
81
|
+
// 每隔一定时间,更新一遍定时器的值
|
|
82
|
+
// 同时此定时器的作用也能带来毫秒级的更新
|
|
83
|
+
this.timer = setTimeout(() => {
|
|
84
|
+
// 获取剩余时间
|
|
85
|
+
const remain = this.getRemainTime()
|
|
86
|
+
// 重设剩余时间
|
|
87
|
+
if (!isSameSecond(remain, this.remainTime) || remain === 0) {
|
|
88
|
+
this.setRemainTime(remain)
|
|
89
|
+
}
|
|
90
|
+
// 如果剩余时间不为0,则继续检查更新倒计时
|
|
91
|
+
if (this.remainTime !== 0) {
|
|
92
|
+
this.macroTick()
|
|
93
|
+
}
|
|
94
|
+
}, 30)
|
|
95
|
+
},
|
|
96
|
+
microTick() {
|
|
97
|
+
this.clearTimeout()
|
|
98
|
+
this.timer = setTimeout(() => {
|
|
99
|
+
this.setRemainTime(this.getRemainTime())
|
|
100
|
+
if (this.remainTime !== 0) {
|
|
101
|
+
this.microTick()
|
|
102
|
+
}
|
|
103
|
+
}, 50)
|
|
104
|
+
},
|
|
105
|
+
// 获取剩余的时间
|
|
106
|
+
getRemainTime() {
|
|
107
|
+
// 取最大值,防止出现小于0的剩余时间值
|
|
108
|
+
return Math.max(this.endTime - Date.now(), 0)
|
|
109
|
+
},
|
|
110
|
+
// 设置剩余的时间
|
|
111
|
+
setRemainTime(remain) {
|
|
112
|
+
this.remainTime = remain
|
|
113
|
+
// 根据剩余的毫秒时间,得出该有天,小时,分钟等的值,返回一个对象
|
|
114
|
+
const timeData = parseTimeData(remain)
|
|
115
|
+
this.$emit('change', timeData)
|
|
116
|
+
// 得出格式化后的时间
|
|
117
|
+
this.formattedTime = parseFormat(this.format, timeData)
|
|
118
|
+
// 如果时间已到,停止倒计时
|
|
119
|
+
if (remain <= 0) {
|
|
120
|
+
this.pause()
|
|
121
|
+
this.$emit('finish')
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
// 重置倒计时
|
|
125
|
+
reset() {
|
|
126
|
+
this.pause()
|
|
127
|
+
this.remainTime = this.time
|
|
128
|
+
this.setRemainTime(this.remainTime)
|
|
129
|
+
if (this.autoStart) {
|
|
130
|
+
this.start()
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
// 暂停倒计时
|
|
134
|
+
pause() {
|
|
135
|
+
this.runing = false;
|
|
136
|
+
this.clearTimeout()
|
|
137
|
+
},
|
|
138
|
+
// 清空定时器
|
|
139
|
+
clearTimeout() {
|
|
140
|
+
clearTimeout(this.timer)
|
|
141
|
+
this.timer = null
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
beforeDestroy() {
|
|
145
|
+
this.clearTimeout()
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style
|
|
151
|
+
lang="scss"
|
|
152
|
+
scoped
|
|
153
|
+
>
|
|
154
|
+
@import "../../libs/css/components.scss";
|
|
155
|
+
$u-count-down-text-color:$u-content-color !default;
|
|
156
|
+
$u-count-down-text-font-size:15px !default;
|
|
157
|
+
$u-count-down-text-line-height:22px !default;
|
|
158
|
+
|
|
159
|
+
.u-count-down {
|
|
160
|
+
&__text {
|
|
161
|
+
color: $u-count-down-text-color;
|
|
162
|
+
font-size: $u-count-down-text-font-size;
|
|
163
|
+
line-height: $u-count-down-text-line-height;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</style>
|