错误信息:
Invalid JSON input: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token;
内部封装时间框,时间转换格式思路不变
{
title: '生效时间与过期时间',
field: 'createTime',
config: {
type: 51,
required: true
}
}
在methods定义时间转换格式时间戳方法
takeTime :开始时间
pastTime:过期时间
exportData: function (data) {
// if (data['checkTime']) {
// data['startCheckTime'] = this.etao.common.formatDate(data['checkTime'][0]) || undefined
// data['endCheckTime'] = this.etao.common.formatDate(data['checkTime'][1]) || undefined
// }
if (data['createTime']) {
data['takeTime'] = this.etao.common.formatDate(data['createTime'][0]) || undefined
data['pastTime'] = this.etao.common.formatDate(data['createTime'][1]) || undefined
}
return data
}
后端req封装的得加一个注解,然后把时间接收并转换过来
@JsonFormat(timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
private Date takeTime;
@JsonFormat(timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
private Date pastTime;