uview-plus 3.4.24 → 3.4.25
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 +7 -0
- package/components/u-datetime-picker/datetimePicker.js +6 -1
- package/components/u-datetime-picker/props.js +9 -3
- package/components/u-datetime-picker/u-datetime-picker.vue +11 -4
- package/components/u-form-item/u-form-item.vue +0 -2
- package/components/u-number-box/u-number-box.vue +6 -2
- package/components/u-picker/picker.js +4 -0
- package/components/u-picker/props.js +13 -8
- package/components/u-picker/u-picker.vue +68 -51
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -32,6 +32,11 @@ export default {
|
|
|
32
32
|
confirmColor: '#3c9cff',
|
|
33
33
|
visibleItemCount: 5,
|
|
34
34
|
closeOnClickOverlay: false,
|
|
35
|
-
defaultIndex: []
|
|
35
|
+
defaultIndex: [],
|
|
36
|
+
inputBorder: 'surround',
|
|
37
|
+
disabled: false,
|
|
38
|
+
disabledColor: '',
|
|
39
|
+
placeholder: '请选择',
|
|
40
|
+
inputProps: {},
|
|
36
41
|
}
|
|
37
42
|
}
|
|
@@ -7,13 +7,19 @@ export const props = defineMixin({
|
|
|
7
7
|
type: Boolean,
|
|
8
8
|
default: false
|
|
9
9
|
},
|
|
10
|
+
inputProps: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: () => {
|
|
13
|
+
return {}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
10
16
|
inputBorder: {
|
|
11
17
|
type: String,
|
|
12
|
-
default:
|
|
18
|
+
default: () => defProps.input.inputBorder
|
|
13
19
|
},
|
|
14
20
|
disabled: {
|
|
15
21
|
type: Boolean,
|
|
16
|
-
default: () =>
|
|
22
|
+
default: () => defProps.input.disabled
|
|
17
23
|
},
|
|
18
24
|
disabledColor:{
|
|
19
25
|
type: String,
|
|
@@ -21,7 +27,7 @@ export const props = defineMixin({
|
|
|
21
27
|
},
|
|
22
28
|
placeholder: {
|
|
23
29
|
type: String,
|
|
24
|
-
default: () =>
|
|
30
|
+
default: () => defProps.input.placeholder
|
|
25
31
|
},
|
|
26
32
|
format: {
|
|
27
33
|
type: String,
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
>
|
|
6
6
|
<slot name="trigger" :value="inputValue">
|
|
7
7
|
<up-input
|
|
8
|
-
:placeholder="placeholder"
|
|
9
8
|
:readonly="!!showByClickInput"
|
|
10
|
-
:border="inputBorder"
|
|
11
9
|
v-model="inputValue"
|
|
12
|
-
|
|
13
|
-
:disabledColor="disabledColor"
|
|
10
|
+
v-bind="inputPropsInner"
|
|
14
11
|
></up-input>
|
|
15
12
|
<div class="input-cover">
|
|
16
13
|
</div>
|
|
@@ -135,6 +132,16 @@
|
|
|
135
132
|
// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
|
|
136
133
|
propsChange() {
|
|
137
134
|
return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, ]
|
|
135
|
+
},
|
|
136
|
+
// input的props
|
|
137
|
+
inputPropsInner() {
|
|
138
|
+
return {
|
|
139
|
+
border: this.inputBorder,
|
|
140
|
+
placeholder: this.placeholder,
|
|
141
|
+
disabled: this.disabled,
|
|
142
|
+
disabledColor: this.disabledColor,
|
|
143
|
+
...this.inputProps
|
|
144
|
+
}
|
|
138
145
|
}
|
|
139
146
|
},
|
|
140
147
|
mounted() {
|
|
@@ -311,13 +311,17 @@
|
|
|
311
311
|
value = ''
|
|
312
312
|
} = e.detail || {}
|
|
313
313
|
// 为空返回
|
|
314
|
-
if (value === '')
|
|
314
|
+
if (value === '') {
|
|
315
|
+
// 为空自动设为最小值
|
|
316
|
+
this.emitChange(this.min)
|
|
317
|
+
return
|
|
318
|
+
}
|
|
315
319
|
let formatted = this.filter(value)
|
|
316
320
|
// https://github.com/ijry/uview-plus/issues/613
|
|
317
321
|
this.emitChange(value);
|
|
318
322
|
// 最大允许的小数长度
|
|
319
323
|
if (this.decimalLength !== null && formatted.indexOf('.') !== -1) {
|
|
320
|
-
const pair = formatted.split('.')
|
|
324
|
+
const pair = formatted.split('.')
|
|
321
325
|
formatted = `${pair[0]}.${pair[1].slice(0, this.decimalLength)}`
|
|
322
326
|
}
|
|
323
327
|
formatted = this.format(formatted)
|
|
@@ -6,22 +6,27 @@ export const props = defineMixin({
|
|
|
6
6
|
type: Array,
|
|
7
7
|
default: () => []
|
|
8
8
|
},
|
|
9
|
-
|
|
10
|
-
disabled: {
|
|
9
|
+
hasInput: {
|
|
11
10
|
type: Boolean,
|
|
12
11
|
default: false
|
|
12
|
+
},
|
|
13
|
+
inputProps: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => {
|
|
16
|
+
return {}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: () => defProps.picker.disabled
|
|
13
22
|
},
|
|
14
23
|
disabledColor:{
|
|
15
24
|
type: String,
|
|
16
|
-
default: () => defProps.
|
|
25
|
+
default: () => defProps.picker.disabledColor
|
|
17
26
|
},
|
|
18
|
-
hasInput: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
22
27
|
placeholder: {
|
|
23
28
|
type: String,
|
|
24
|
-
default: () =>
|
|
29
|
+
default: () => defProps.picker.placeholder
|
|
25
30
|
},
|
|
26
31
|
// 是否展示picker弹窗
|
|
27
32
|
show: {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-picker-warrper">
|
|
3
|
-
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
|
|
4
|
-
<slot>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</slot>
|
|
3
|
+
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
|
|
4
|
+
<slot :value="inputLabel">
|
|
5
|
+
</slot>
|
|
6
|
+
<slot name="trigger" :value="inputLabel">
|
|
7
|
+
</slot>
|
|
8
|
+
<up-input
|
|
9
|
+
v-if="!$slots['default'] && !$slots['$default'] && !$slots['trigger']"
|
|
10
|
+
:readonly="true"
|
|
11
|
+
v-model="inputLabel"
|
|
12
|
+
v-bind="inputPropsInner">
|
|
13
|
+
</up-input>
|
|
14
|
+
<div class="input-cover"></div>
|
|
8
15
|
</view>
|
|
9
16
|
<u-popup
|
|
10
17
|
:show="show || (hasInput && showByClickInput)"
|
|
@@ -122,11 +129,11 @@ export default {
|
|
|
122
129
|
immediate: true,
|
|
123
130
|
deep:true,
|
|
124
131
|
handler(n,o) {
|
|
125
|
-
// 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
|
|
126
|
-
// v-model的值变化时候导致defaultIndexwatch也会执行的问题
|
|
127
|
-
//单纯vue不会出现
|
|
128
|
-
if (!o || n.join("/") != o.join("/")) {
|
|
129
|
-
this.setIndexs(n, true)
|
|
132
|
+
// 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
|
|
133
|
+
// v-model的值变化时候导致defaultIndexwatch也会执行的问题
|
|
134
|
+
//单纯vue不会出现
|
|
135
|
+
if (!o || n.join("/") != o.join("/")) {
|
|
136
|
+
this.setIndexs(n, true)
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
139
|
},
|
|
@@ -141,37 +148,47 @@ export default {
|
|
|
141
148
|
},
|
|
142
149
|
emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
|
|
143
150
|
computed: {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
151
|
+
// input的props
|
|
152
|
+
inputPropsInner() {
|
|
153
|
+
return {
|
|
154
|
+
border: this.inputBorder,
|
|
155
|
+
placeholder: this.placeholder,
|
|
156
|
+
disabled: this.disabled,
|
|
157
|
+
disabledColor: this.disabledColor,
|
|
158
|
+
...this.inputProps
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
//已选&&已确认的值显示在input上面的文案
|
|
162
|
+
inputLabel() {
|
|
163
|
+
let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
|
|
164
|
+
// //区分是不是对象数组
|
|
165
|
+
if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
|
|
166
|
+
let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
|
|
167
|
+
res = res.map(item => item[this.keyName]);
|
|
168
|
+
return res.join("/");
|
|
169
|
+
|
|
170
|
+
} else {
|
|
171
|
+
//用户确定的值,才显示到输入框
|
|
172
|
+
return this.modelValue.join("/");
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
//已选,待确认的值
|
|
176
|
+
inputValue() {
|
|
177
|
+
let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
|
|
178
|
+
let res = []
|
|
179
|
+
//区分是不是对象数组
|
|
180
|
+
if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
|
|
181
|
+
//对象数组返回id集合
|
|
182
|
+
items.forEach(element => {
|
|
183
|
+
res.push(element && element['id'])
|
|
184
|
+
});
|
|
185
|
+
} else {
|
|
186
|
+
//非对象数组返回元素集合
|
|
187
|
+
items.forEach((element, index) => {
|
|
188
|
+
res.push(element)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return res
|
|
175
192
|
}
|
|
176
193
|
},
|
|
177
194
|
methods: {
|
|
@@ -346,17 +363,17 @@ export default {
|
|
|
346
363
|
|
|
347
364
|
.u-picker {
|
|
348
365
|
position: relative;
|
|
349
|
-
&-input {
|
|
350
|
-
position: relative;
|
|
351
|
-
.input-cover {
|
|
352
|
-
opacity: 0;
|
|
353
|
-
position: absolute;
|
|
354
|
-
top: 0;
|
|
355
|
-
bottom: 0;
|
|
356
|
-
left: 0;
|
|
366
|
+
&-input {
|
|
367
|
+
position: relative;
|
|
368
|
+
.input-cover {
|
|
369
|
+
opacity: 0;
|
|
370
|
+
position: absolute;
|
|
371
|
+
top: 0;
|
|
372
|
+
bottom: 0;
|
|
373
|
+
left: 0;
|
|
357
374
|
right: 0;
|
|
358
|
-
z-index:1;
|
|
359
|
-
}
|
|
375
|
+
z-index:1;
|
|
376
|
+
}
|
|
360
377
|
}
|
|
361
378
|
&__view {
|
|
362
379
|
|
package/package.json
CHANGED