mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-25 11:06:45 +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[] {
|
function times(n: number, iteratee: (index: number) => string): string[] {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
const result = Array(n);
|
const result = Array(n < 0 ? 0 : n);
|
||||||
|
|
||||||
while (++index < n) {
|
while (++index < n) {
|
||||||
result[index] = iteratee(index);
|
result[index] = iteratee(index);
|
||||||
@ -135,7 +135,7 @@ VantComponent({
|
|||||||
return this.set({ columns: results });
|
return this.set({ columns: results });
|
||||||
},
|
},
|
||||||
|
|
||||||
getRanges(): object[] {
|
getRanges() {
|
||||||
const { data } = this;
|
const { data } = this;
|
||||||
if (data.type === 'time') {
|
if (data.type === 'time') {
|
||||||
return [
|
return [
|
||||||
@ -220,7 +220,7 @@ VantComponent({
|
|||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
getBoundary(type: string, innerValue: number): object {
|
getBoundary(type: string, innerValue: number) {
|
||||||
const value = new Date(innerValue);
|
const value = new Date(innerValue);
|
||||||
const boundary = new Date(this.data[`${type}Date`]);
|
const boundary = new Date(this.data[`${type}Date`]);
|
||||||
const year = boundary.getFullYear();
|
const year = boundary.getFullYear();
|
||||||
@ -262,11 +262,11 @@ VantComponent({
|
|||||||
this.$emit('cancel');
|
this.$emit('cancel');
|
||||||
},
|
},
|
||||||
|
|
||||||
onConfirm(): void {
|
onConfirm() {
|
||||||
this.$emit('confirm', this.data.innerValue);
|
this.$emit('confirm', this.data.innerValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange(): void {
|
onChange() {
|
||||||
const { data } = this;
|
const { data } = this;
|
||||||
let value;
|
let value;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user