a-time-picker 时间回显问题  回显为Invalid date 

ant design vue中 时间选择器,需要使用到moment

  • 安装moment 组件
  • 引入moment 组件
  • 回显的时候进行moment处理
<template>
    <a-time-picker
        v-model="dutyFromTimeSlotValue"
        format="HH:mm:ss"
     @chang="onTime"
/> </template> <style> import moment from 'moment' data() { return { moment //或引用再methods:{moment} }, }, created() { this.dutyFromTimeSlotValue = moment('12:04:01', 'HH:mm:ss') //moment(变量,'HH:mm:ss') } </style>

注:

this.dutyFromTimeSlotValue = moment('12:04:01').format( 'HH:mm:ss') //回显使用会失效,这个常用于chang回调函数转化格式

 

相关文章:

  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案