nmxiaowei / avue

Avue.js2.0是基于现有的element-ui库进行的二次封装,简化一些繁琐的操作,核心理念为数据驱动视图,主要的组件库针对table表格和form表单场景,同时衍生出更多企业常用的组件,达到高复用,容易维护和扩展的框架,同时内置了丰富了数据展示组件,让开发变得更加容易
https://avuejs.com
MIT License
2.22k stars 488 forks source link

类型是datetime,时间戳格式选择小时无效 #644

Closed limingzhiguang closed 10 months ago

limingzhiguang commented 10 months ago

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'

nmxiaowei commented 10 months ago

{ label: "时间戳", prop: "datetime", type: "datetime", format: 'YYYY-MM-DD HH:mm:ss', valueFormat: "timestamp", }

limingzhiguang commented 10 months ago

找到原因了 这是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”

nmxiaowei commented 10 months ago
image

看样子的确是