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}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
<!-- 日期时间选择器 -->
|
||||
<v-list-item-content v-if="formItem.type === 'time'" class="py-0">
|
||||
<date-time-picker :disabled='disabled' @save-date-time="setDateTime" v-model="formItem.answer"></date-time-picker>
|
||||
<date-time-picker :disabled='disabled' v-model="formItem.answer"></date-time-picker>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
@@ -103,7 +103,7 @@ Vue.component("form-component-list", {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
datetime:"2023-12-24 22:23",
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -113,9 +113,6 @@ Vue.component("form-component-list", {
|
||||
|
||||
},
|
||||
methods: {
|
||||
setDateTime(data){
|
||||
this.datetime = data
|
||||
},
|
||||
async calcWorkflow(){
|
||||
await this.$emit('calc-workflow')
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user