2

问题: el-time-picker筛选出某个时间点保存,之后从后台获取该时间,页面显示

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

image.png

image.png

解决: 字符串转date

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 {

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;

}
`


element
28 声望4 粉丝