mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-23 15:09:16 +08:00
[improvement] DatetimePicker: optimize padZero
This commit is contained in:
parent
ab441cca9e
commit
fadf941e89
@ -149,8 +149,7 @@ export default sfc({
|
|||||||
columns() {
|
columns() {
|
||||||
const results = this.ranges.map(({ type, range: rangeArr }) => {
|
const results = this.ranges.map(({ type, range: rangeArr }) => {
|
||||||
let values = times(rangeArr[1] - rangeArr[0] + 1, index => {
|
let values = times(rangeArr[1] - rangeArr[0] + 1, index => {
|
||||||
let value = rangeArr[0] + index;
|
const value = padZero(rangeArr[0] + index);
|
||||||
value = value < 10 ? `0${value}` : `${value}`;
|
|
||||||
return this.formatter(type, value);
|
return this.formatter(type, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -179,8 +178,7 @@ export default sfc({
|
|||||||
if (isDateType && !isValidDate(value)) {
|
if (isDateType && !isValidDate(value)) {
|
||||||
value = this.minDate;
|
value = this.minDate;
|
||||||
} else if (!value) {
|
} else if (!value) {
|
||||||
const { minHour } = this;
|
value = `${padZero(this.minHour)}:00`;
|
||||||
value = `${minHour > 10 ? minHour : '0' + minHour}:00`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// time type
|
// time type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user