Warning: [antdv: DatePicker] `value` provides invalidate moment time. If you want to set empty value、或TimePicker 时间选择框报waring

Warning: [antdv: DatePicker] `value` provides invalidate moment time. If you want to set empty value、或TimePicker 时间选择框报waring

a-date-picker/a-time-picker绑定的时间变量是一个string类型,而ant design vue datepicker 默认需要moment格式,所以会报错。

 1                         <a-col :xs="24" :md="12" :sm="24" :lg=‘16‘ :xl=‘6‘>
 2                             <a-form-item label="时间">
 3                                 <a-date-picker
 4                                     v-model="pickerDate"
 5                                     @change="onChange"
 6                                     style="margin-right: 5px;"
 7                                 />
 8                                 <a-time-picker
 9                                     v-model="picker"
10                                     format="HH:mm"
11                                     @change="onPicker"
12                                     placeholder="时间"
13                                 />
14                                 ~
15                                 <a-time-picker
16                                     v-model="picker1"
17                                     @change="onPicker1"
18                                     format="HH:mm"
19                                     placeholder="时间"
20                                 />
21                             </a-form-item>
22                         </a-col>

Warning: [antdv: DatePicker] `value` provides invalidate moment time. If you want to set empty value、或TimePicker 时间选择框报waring

 

 

Js

 1 import moment from ‘moment‘
 2 export default {
 3     
 4     data(){
 5             // pickerl:‘ ‘不可为字符串切记
 6             picker: moment(‘00:00‘, ‘HH:mm‘), //默认值
 7             picker1: moment(new Date(), ‘HH:mm‘), //默认值
 8             pickerDate: moment(new Date(), ‘YYYY-MM-DD‘), //默认值
 9     } ,
10     methods:{
11         moment,
12     }
13 }  

 

Warning: [antdv: DatePicker] `value` provides invalidate moment time. If you want to set empty value、或TimePicker 时间选择框报waring

上一篇:selenium


下一篇:Vue系统学习:01、操作data数据