element ui el-time-picker賦值(HH:ss)後界面不顯示

問題: el-time-picker篩選出某個時間點保存,以後從後臺獲取該時間,頁面顯示spa

`
<el-time-picker class="my_time_picker_32" :clearable="false" v-model="scope.row.plan[index]" placeholder="時間" format="HH:mm"></el-time-picker>
`code

image.png

image.png

解決: 字符串轉dateorm

const _converTime = ac.plan.map((item: any) => {
  const _arr: string[] = item.split(':');
  
  return new Date(2010, 10, 10, Number(_arr[0]),   Number(_arr[1]));
});

附:選中的時間點過濾出時分
`
private dateConversion(value: any): string {blog

const d = new Date(value);
let _h =  d.getHours() + '';
if (_h.length === 1) {
  _h = '0' + _h;
}
let _m = d.getMinutes() + '';
if (_m.length === 1) {
  _m = '0' + _m;
}
return _h + ':' + _m;

}
`字符串

相關文章
相關標籤/搜索