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回調函數轉化格式