mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[bugfix] DatetimePicker: 修复wepy中组件初始化报错
This commit is contained in:
parent
3a8e6f4ab6
commit
0e90955aa5
@ -18,7 +18,7 @@ function padZero(val: string | number): string {
|
||||
|
||||
function times(n: number, iteratee: (index: number) => string): string[] {
|
||||
let index = -1;
|
||||
const result = Array(n);
|
||||
const result = Array(n < 0 ? 0 : n);
|
||||
|
||||
while (++index < n) {
|
||||
result[index] = iteratee(index);
|
||||
@ -135,7 +135,7 @@ VantComponent({
|
||||
return this.set({ columns: results });
|
||||
},
|
||||
|
||||
getRanges(): object[] {
|
||||
getRanges() {
|
||||
const { data } = this;
|
||||
if (data.type === 'time') {
|
||||
return [
|
||||
@ -220,7 +220,7 @@ VantComponent({
|
||||
return value;
|
||||
},
|
||||
|
||||
getBoundary(type: string, innerValue: number): object {
|
||||
getBoundary(type: string, innerValue: number) {
|
||||
const value = new Date(innerValue);
|
||||
const boundary = new Date(this.data[`${type}Date`]);
|
||||
const year = boundary.getFullYear();
|
||||
@ -262,11 +262,11 @@ VantComponent({
|
||||
this.$emit('cancel');
|
||||
},
|
||||
|
||||
onConfirm(): void {
|
||||
onConfirm() {
|
||||
this.$emit('confirm', this.data.innerValue);
|
||||
},
|
||||
|
||||
onChange(): void {
|
||||
onChange() {
|
||||
const { data } = this;
|
||||
let value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user