mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
fix: 修复 DatePicker 组件设置初始时间时报错的问题 (#350)
This commit is contained in:
parent
19773e2da4
commit
eaa2f430f3
@ -24,6 +24,7 @@ Component({
|
|||||||
if (/^[0-9]+$/.test(value)) {
|
if (/^[0-9]+$/.test(value)) {
|
||||||
value = +value
|
value = +value
|
||||||
}
|
}
|
||||||
|
!this._inited && this._init()
|
||||||
this.updateDate(value)
|
this.updateDate(value)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -36,6 +37,12 @@ Component({
|
|||||||
transPos: [0, 0, 0, 0, 0, 0]
|
transPos: [0, 0, 0, 0, 0, 0]
|
||||||
},
|
},
|
||||||
attached() {
|
attached() {
|
||||||
|
!this._inited && this._init()
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
_init () {
|
||||||
|
this._inited = true
|
||||||
this.use = {};
|
this.use = {};
|
||||||
|
|
||||||
['years', 'months', 'days', 'hours', 'minutes', 'seconds'].forEach((item) => {
|
['years', 'months', 'days', 'hours', 'minutes', 'seconds'].forEach((item) => {
|
||||||
@ -60,8 +67,6 @@ Component({
|
|||||||
|
|
||||||
this._indexs = selected
|
this._indexs = selected
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
|
||||||
updatePicker(updateData = []) {
|
updatePicker(updateData = []) {
|
||||||
let _updateData = {};
|
let _updateData = {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user