fix Bug:时间选择器
This commit is contained in:
1 parent
d2cfd28e41
commit
7e094cd83e
2 files changed
+6
-12
No files matched your search
@@ -61,13 +61,13 @@ Vue.component("date-time-picker", {
|
||||
},
|
||||
watch: {
|
||||
date(){
|
||||
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||
this.saveDateTime()
|
||||
},
|
||||
hour(){
|
||||
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||
this.saveDateTime()
|
||||
},
|
||||
minute(){
|
||||
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||
this.saveDateTime()
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
@@ -87,15 +87,12 @@ Vue.component("date-time-picker", {
|
||||
return;
|
||||
}
|
||||
let datetime = dayjs(this.datetime)
|
||||
console.log(datetime);
|
||||
this.date = `${datetime.year()}-${datetime.month()+1}-${datetime.date()}`
|
||||
this.hour = `${datetime.hour()}`
|
||||
this.minute = `${datetime.minute()}`
|
||||
console.log(this.hour, this.minute);
|
||||
// this.time = `${date.hour()<10?'0'+date.hour():date.hour()}:${date.minute()<10?'0'+date.minute():date.minute()}`
|
||||
},
|
||||
saveDateTime(){
|
||||
|
||||
this.$emit('input', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user