@10yun/cv-mobile-ui 0.5.20 → 0.5.21
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/package.json +1 -1
- package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
- package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
- package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
- package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
- package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
- package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
- package/uni-ui/lib/uni-card/uni-card.vue +124 -1
- package/uni-ui/lib/uni-col/uni-col.vue +1 -1
- package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
- package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
- package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
- package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
- package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
- package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
- package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
- package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
- package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
- package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
- package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
- package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
- package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
- package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
- package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
- package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
- package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
- package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
- package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
- package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
- package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
- package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
- package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
- package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
- package/uni-ui/lib/uni-group/uni-group.vue +85 -1
- package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
- package/uni-ui/lib/uni-list/uni-list.vue +81 -1
- package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
- package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
- package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
- package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
- package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
- package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
- package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
- package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
- package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
- package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
- package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
- package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
- package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
- package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
- package/uni-ui/lib/uni-row/uni-row.vue +1 -1
- package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
- package/uni-ui/lib/uni-section/uni-section.vue +109 -1
- package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
- package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
- package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
- package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
- package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
- package/uni-ui/lib/uni-table/uni-table.vue +297 -1
- package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
- package/uni-ui/lib/uni-td/uni-td.vue +78 -1
- package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
- package/uni-ui/lib/uni-th/uni-th.vue +224 -1
- package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
- package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
- package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
|
@@ -1 +1,166 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="uni-numbox">
|
|
3
2
|
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{ background }">
|
|
4
3
|
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{ color }">
|
|
5
4
|
-
|
|
6
5
|
</text>
|
|
7
6
|
</view>
|
|
8
7
|
<input
|
|
9
8
|
:disabled="disabled"
|
|
10
9
|
@focus="_onFocus"
|
|
11
10
|
@blur="_onBlur"
|
|
12
11
|
class="uni-numbox__value"
|
|
13
12
|
type="number"
|
|
14
13
|
v-model="inputValue"
|
|
15
14
|
:style="{ background, color }"
|
|
16
15
|
/>
|
|
17
16
|
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{ background }">
|
|
18
17
|
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{ color }">
|
|
19
18
|
+
|
|
20
19
|
</text>
|
|
21
20
|
</view>
|
|
22
21
|
</view>
|
|
23
22
|
* NumberBox 数字输入框
|
|
24
23
|
* @description 带加减按钮的数字输入框
|
|
25
24
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
|
|
26
25
|
* @property {Number} value 输入框当前值
|
|
27
26
|
* @property {Number} min 最小值
|
|
28
27
|
* @property {Number} max 最大值
|
|
29
28
|
* @property {Number} step 每次点击改变的间隔大小
|
|
30
29
|
* @property {String} background 背景色
|
|
31
30
|
* @property {String} color 字体颜色(前景色)
|
|
32
31
|
* @property {Boolean} disabled = [true|false] 是否为禁用状态
|
|
33
32
|
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
|
|
34
33
|
* @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象
|
|
35
34
|
* @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象
|
|
36
35
|
*/
|
|
37
36
|
name: 'UniNumberBox',
|
|
38
37
|
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
|
|
39
38
|
props: {
|
|
40
39
|
value: {
|
|
41
40
|
type: [Number, String],
|
|
42
41
|
default: 1
|
|
43
42
|
},
|
|
44
43
|
modelValue: {
|
|
45
44
|
type: [Number, String],
|
|
46
45
|
default: 1
|
|
47
46
|
},
|
|
48
47
|
min: {
|
|
49
48
|
type: Number,
|
|
50
49
|
default: 0
|
|
51
50
|
},
|
|
52
51
|
max: {
|
|
53
52
|
type: Number,
|
|
54
53
|
default: 100
|
|
55
54
|
},
|
|
56
55
|
step: {
|
|
57
56
|
type: Number,
|
|
58
57
|
default: 1
|
|
59
58
|
},
|
|
60
59
|
background: {
|
|
61
60
|
type: String,
|
|
62
61
|
default: '#f5f5f5'
|
|
63
62
|
},
|
|
64
63
|
color: {
|
|
65
64
|
type: String,
|
|
66
65
|
default: '#333'
|
|
67
66
|
},
|
|
68
67
|
disabled: {
|
|
69
68
|
type: Boolean,
|
|
70
69
|
default: false
|
|
71
70
|
}
|
|
72
71
|
},
|
|
73
72
|
data() {
|
|
74
73
|
return {
|
|
75
74
|
inputValue: 0
|
|
76
75
|
};
|
|
77
76
|
},
|
|
78
77
|
watch: {
|
|
79
78
|
value(val) {
|
|
80
79
|
this.inputValue = +val;
|
|
81
80
|
},
|
|
82
81
|
modelValue(val) {
|
|
83
82
|
this.inputValue = +val;
|
|
84
83
|
}
|
|
85
84
|
},
|
|
86
85
|
created() {
|
|
87
86
|
if (this.value === 1) {
|
|
88
87
|
this.inputValue = +this.modelValue;
|
|
89
88
|
}
|
|
90
89
|
if (this.modelValue === 1) {
|
|
91
90
|
this.inputValue = +this.value;
|
|
92
91
|
}
|
|
93
92
|
},
|
|
94
93
|
methods: {
|
|
95
94
|
_calcValue(type) {
|
|
96
95
|
if (this.disabled) {
|
|
97
96
|
return;
|
|
98
97
|
}
|
|
99
98
|
const scale = this._getDecimalScale();
|
|
100
99
|
let value = this.inputValue * scale;
|
|
101
100
|
let step = this.step * scale;
|
|
102
101
|
if (type === 'minus') {
|
|
103
102
|
value -= step;
|
|
104
103
|
if (value < this.min * scale) {
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
106
|
if (value > this.max * scale) {
|
|
108
107
|
value = this.max * scale;
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
if (type === 'plus') {
|
|
112
111
|
value += step;
|
|
113
112
|
if (value > this.max * scale) {
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
116
115
|
if (value < this.min * scale) {
|
|
117
116
|
value = this.min * scale;
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
|
|
121
120
|
// TODO vue2 兼容
|
|
122
121
|
this.$emit('input', +this.inputValue);
|
|
123
122
|
// TODO vue3 兼容
|
|
124
123
|
this.$emit('update:modelValue', +this.inputValue);
|
|
125
124
|
this.$emit('change', +this.inputValue);
|
|
126
125
|
},
|
|
127
126
|
_getDecimalScale() {
|
|
128
127
|
let scale = 1;
|
|
129
128
|
// 浮点型
|
|
130
129
|
if (~~this.step !== this.step) {
|
|
131
130
|
scale = Math.pow(10, String(this.step).split('.')[1].length);
|
|
132
131
|
}
|
|
133
132
|
return scale;
|
|
134
133
|
},
|
|
135
134
|
_onBlur(event) {
|
|
136
135
|
this.$emit('blur', event);
|
|
137
136
|
let value = event.detail.value;
|
|
138
137
|
if (isNaN(value)) {
|
|
139
138
|
this.inputValue = this.min;
|
|
140
139
|
return;
|
|
141
140
|
}
|
|
142
141
|
value = +value;
|
|
143
142
|
if (value > this.max) {
|
|
144
143
|
value = this.max;
|
|
145
144
|
} else if (value < this.min) {
|
|
146
145
|
value = this.min;
|
|
147
146
|
}
|
|
148
147
|
const scale = this._getDecimalScale();
|
|
149
148
|
this.inputValue = value.toFixed(String(scale).length - 1);
|
|
150
149
|
this.$emit('input', +this.inputValue);
|
|
151
150
|
this.$emit('update:modelValue', +this.inputValue);
|
|
152
151
|
this.$emit('change', +this.inputValue);
|
|
153
152
|
},
|
|
154
153
|
_onFocus(event) {
|
|
155
154
|
this.$emit('focus', event);
|
|
156
155
|
}
|
|
157
156
|
}
|
|
157
|
+
<template>
|
|
158
|
+
<view class="uni-numbox">
|
|
159
|
+
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{ background }">
|
|
160
|
+
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{ color }">
|
|
161
|
+
-
|
|
162
|
+
</text>
|
|
163
|
+
</view>
|
|
164
|
+
<input
|
|
165
|
+
:disabled="disabled"
|
|
166
|
+
@focus="_onFocus"
|
|
167
|
+
@blur="_onBlur"
|
|
168
|
+
class="uni-numbox__value"
|
|
169
|
+
type="number"
|
|
170
|
+
v-model="inputValue"
|
|
171
|
+
:style="{ background, color }"
|
|
172
|
+
/>
|
|
173
|
+
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{ background }">
|
|
174
|
+
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{ color }">
|
|
175
|
+
+
|
|
176
|
+
</text>
|
|
177
|
+
</view>
|
|
178
|
+
</view>
|
|
179
|
+
</template>
|
|
180
|
+
<script>
|
|
181
|
+
/**
|
|
182
|
+
* NumberBox 数字输入框
|
|
183
|
+
* @description 带加减按钮的数字输入框
|
|
184
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
|
|
185
|
+
* @property {Number} value 输入框当前值
|
|
186
|
+
* @property {Number} min 最小值
|
|
187
|
+
* @property {Number} max 最大值
|
|
188
|
+
* @property {Number} step 每次点击改变的间隔大小
|
|
189
|
+
* @property {String} background 背景色
|
|
190
|
+
* @property {String} color 字体颜色(前景色)
|
|
191
|
+
* @property {Boolean} disabled = [true|false] 是否为禁用状态
|
|
192
|
+
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
|
|
193
|
+
* @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象
|
|
194
|
+
* @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象
|
|
195
|
+
*/
|
|
196
|
+
export default {
|
|
197
|
+
name: 'UniNumberBox',
|
|
198
|
+
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
|
|
199
|
+
props: {
|
|
200
|
+
value: {
|
|
201
|
+
type: [Number, String],
|
|
202
|
+
default: 1
|
|
203
|
+
},
|
|
204
|
+
modelValue: {
|
|
205
|
+
type: [Number, String],
|
|
206
|
+
default: 1
|
|
207
|
+
},
|
|
208
|
+
min: {
|
|
209
|
+
type: Number,
|
|
210
|
+
default: 0
|
|
211
|
+
},
|
|
212
|
+
max: {
|
|
213
|
+
type: Number,
|
|
214
|
+
default: 100
|
|
215
|
+
},
|
|
216
|
+
step: {
|
|
217
|
+
type: Number,
|
|
218
|
+
default: 1
|
|
219
|
+
},
|
|
220
|
+
background: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: '#f5f5f5'
|
|
223
|
+
},
|
|
224
|
+
color: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: '#333'
|
|
227
|
+
},
|
|
228
|
+
disabled: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
default: false
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
data() {
|
|
234
|
+
return {
|
|
235
|
+
inputValue: 0
|
|
236
|
+
};
|
|
237
|
+
},
|
|
238
|
+
watch: {
|
|
239
|
+
value(val) {
|
|
240
|
+
this.inputValue = +val;
|
|
241
|
+
},
|
|
242
|
+
modelValue(val) {
|
|
243
|
+
this.inputValue = +val;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
created() {
|
|
247
|
+
if (this.value === 1) {
|
|
248
|
+
this.inputValue = +this.modelValue;
|
|
249
|
+
}
|
|
250
|
+
if (this.modelValue === 1) {
|
|
251
|
+
this.inputValue = +this.value;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
methods: {
|
|
255
|
+
_calcValue(type) {
|
|
256
|
+
if (this.disabled) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const scale = this._getDecimalScale();
|
|
260
|
+
let value = this.inputValue * scale;
|
|
261
|
+
let step = this.step * scale;
|
|
262
|
+
if (type === 'minus') {
|
|
263
|
+
value -= step;
|
|
264
|
+
if (value < this.min * scale) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (value > this.max * scale) {
|
|
268
|
+
value = this.max * scale;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (type === 'plus') {
|
|
272
|
+
value += step;
|
|
273
|
+
if (value > this.max * scale) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (value < this.min * scale) {
|
|
277
|
+
value = this.min * scale;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
|
|
281
|
+
// TODO vue2 兼容
|
|
282
|
+
this.$emit('input', +this.inputValue);
|
|
283
|
+
// TODO vue3 兼容
|
|
284
|
+
this.$emit('update:modelValue', +this.inputValue);
|
|
285
|
+
this.$emit('change', +this.inputValue);
|
|
286
|
+
},
|
|
287
|
+
_getDecimalScale() {
|
|
288
|
+
let scale = 1;
|
|
289
|
+
// 浮点型
|
|
290
|
+
if (~~this.step !== this.step) {
|
|
291
|
+
scale = Math.pow(10, String(this.step).split('.')[1].length);
|
|
292
|
+
}
|
|
293
|
+
return scale;
|
|
294
|
+
},
|
|
295
|
+
_onBlur(event) {
|
|
296
|
+
this.$emit('blur', event);
|
|
297
|
+
let value = event.detail.value;
|
|
298
|
+
if (isNaN(value)) {
|
|
299
|
+
this.inputValue = this.min;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
value = +value;
|
|
303
|
+
if (value > this.max) {
|
|
304
|
+
value = this.max;
|
|
305
|
+
} else if (value < this.min) {
|
|
306
|
+
value = this.min;
|
|
307
|
+
}
|
|
308
|
+
const scale = this._getDecimalScale();
|
|
309
|
+
this.inputValue = value.toFixed(String(scale).length - 1);
|
|
310
|
+
this.$emit('input', +this.inputValue);
|
|
311
|
+
this.$emit('update:modelValue', +this.inputValue);
|
|
312
|
+
this.$emit('change', +this.inputValue);
|
|
313
|
+
},
|
|
314
|
+
_onFocus(event) {
|
|
315
|
+
this.$emit('focus', event);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
</script>
|
|
320
|
+
<style>
|
|
321
|
+
@import 'style.css';
|
|
322
|
+
</style>
|