1. 数据绑定视图
<a-col :md="12" :sm="24">
<a-form-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-time-picker v-model="worktimeInfo.start_time" format="HH:mm"/>
</a-form-item>
</a-col>
<a-col :md="12" :sm="24">
<a-form-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-time-picker v-model="worktimeInfo.end_time" format="HH:mm"/>
</a-form-item>
</a-col>
2 .数据初始为null
worktimeInfo: {
start_time: null,
end_time: null,
},
3.设置值的格式
this.worktimeInfo.start_time = moment(this.worktimeInfo.start_time).format('HH:mm') //错误格式
this.worktimeInfo.start_time = moment(this.worktimeInfo.start_time,'HH:mm') //正确格式