如果没有进行日历表单的格式化,那么在使用element的表单日历中取值时将会得到一个日期对象。
需要通过valueof这个函数对时间对象进行取值,得到一个时间,再通过dayjs进行格式化,得到自己想要的格式。
let test = form_temp.createTime;
console.log(`我是日期对象:${test},我的类型是:${typeof test}`)
let temp_time = form_temp.createTime.valueOf();//通过valueOf函数取出时间戳。
console.log("我是取值的日期时间戳:",temp_time)
const temp_time_T = dayjs(temp_time).format("YYYY-MM-DD") //然后通过dayjs进行格式化。
记录一下这个坑。完毕。