1、日期转换Bug
dex.js:349 Uncaught (in promise) RangeError: Invalid time value
at format (index.js:349:11)
const formatDate = (row, index, cellValue)=>{
return format(cellValue, 'yyyy-MM-dd') //此处有问题
}
表明当前要转换的日期不符合转换函数的要求,添加new Date()方法
const formatDate = (row, index, cellValue)=>{
return format(new Date(cellValue), 'yyyy-MM-dd') //更正
}
2、400 错误:数组存数据库Bug
前端:
后端:
2023-08-08 22:19:51.996 WARN 16708 — [nio-8060-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.lang.String
from Array value (token JsonToken.START_ARRAY
); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.lang.String
from Array value (token JsonToken.START_ARRAY
) at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 210] (through reference chain: com.bank.cif.entity.Fac[“purpose”])]
前端为
用join函数把数组变成字符串再存数据库
form.data.purpose = form.data.purposeCK.join(',')
3、vue前端,菜单栏el-sub-menu
in.vue?t=1691673060967:118 [Vue warn]: Invalid prop: type check failed for prop “index”. Expected String with value “7”, got Number with value 7.
使用ElementUI库的el-submenu组件index属性需要传String类型的值,但是id一般时Number类型的,所以报错了
4、数据类型转换错误
1)前端传Object给后端,后端要接收的确是ArrayList集合
JSON parse error: Cannot deserialize value of type java.util.ArrayList<java.lang.Object>
from Object value (token JsonToken.START_OBJECT
);
解决方法:
将对象或数组,使用JSON.stringify()方法,转成string类型并发送
同时把后台的接收类型也转换成String
打印结果如下