fix bug: 时间日期选择器

This commit is contained in:
ChenXinXin committed 2024-05-09 16:01:48 +08:00
1 parent d4932fa7a8
commit fbbf5a88d4
1 file changed
+9 -8
@@ -36,9 +36,9 @@
Vue.component("date-time-picker", {
template: '#date-time-picker',
props: {
datetime: {
type: [Date, String],
default: null,
value: {
type: String,
default: ''
},
disabled: {
type: Boolean,
@@ -52,8 +52,6 @@ Vue.component("date-time-picker", {
v => !!v || '必填',
],
},
constantObj: {
},
date: null,
hour: null,
minute: null
@@ -72,21 +70,24 @@ Vue.component("date-time-picker", {
},
created() {},
mounted() {
this.init()
this.doUiAction('init')
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'init':
await this.init();
break;
default:
console.error("[doUiAction] uiActionId not find", {uiActionId});
break;
}
},
init(){
if (!this.datetime) {
if (!this.value) {
return;
}
let datetime = dayjs(this.datetime)
let datetime = dayjs(this.value)
this.date = `${datetime.year()}-${datetime.month()+1}-${datetime.date()}`
this.hour = `${datetime.hour()}`
this.minute = `${datetime.minute()}`