引言:后端传递给前端去展示时间的时候将时间转化为String类型的时间数据去返回。此时就需要加上 @JsonFormat 注解来解决这个问题。
框架环境配置中,时间配置为
情形一:
- 数据库字段exam_time类型为date
- 后端实体类中examTime类型为Date
1.前端绑定的examTime类型type设置为datetime,以String类型进行传递
<el-date-picker v-model="dataForm.examTime" type="datetime" :picker-options="pickerOptions" placeholder="考试时间"></el-date-picker>
若以上面的前后端字段设置,在进行时间传递的时候,交互会报错。
解决方法:
(1&#