Closed limingzhiguang closed 10 months ago
{ label: "时间戳", prop: "datetime", type: "datetime", format: 'YYYY-MM-DD HH:mm:ss', valueFormat: "timestamp", }
找到原因了
这是vue3的处理代码
export const formatter = function ( date: string | number | Date | Dayjs, format: string | undefined, lang: string ) { if (isEmpty(format)) return date if (format === 'x') return +date return dayjs(date).locale(lang).format(format) }
这是vue2的处理代码
const DATE_FORMATTER = function(value, format) { if (format === 'timestamp') return value.getTime(); return formatDate(value, format); };
结论:vue3对时间戳的支持是 valueFormat="x",vue2是valueFormat=“timestamp”
看样子的确是
avue版本:v3.2.23
{ label: "时间戳", prop: "datetime", type: "datetime", format: "yyyy-MM-dd hh:mm:ss", valueFormat: "timestamp", }
说明:valueFormat: "timestamp" 时间戳形式小时选择无效;这种格式正常 valueFormat:'yyyy-MM-dd HH:mm:ss'