赞
踩
时间选择器选择时间,传入后端报错
- 2023-12-21 13:15:27.683 WARN 11736 --- [nio-8090-exec-5] .w.s.m.s.DefaultHandlerExceptionResolver
- : Resolved [org.springframework.http.converter.HttpMessageNotReadableException
- : JSON parse error
- : Cannot deserialize value of type `java.time.LocalDateTime` from String "12-21 13:14"
- : Failed to deserialize java.time.LocalDateTime:
- (java.time.format.DateTimeParseException) Text '12-21 13:14' could not be parsed at index 0;
- nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException
- : Cannot deserialize value of type `java.time.LocalDateTime` from String "12-21 13:14"
- : Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '12-21 13:14' could not be parsed at index 0<EOL> at
- [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 52] (through reference chain: com.example.memo.entity.Todo["time"])]
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime time;
- data() {
- return {
- //时间选择器
- time:'',
- show:false,
- params: {
- year: true,
- month: true,
- day: true,
- hour: true,
- minute: true,
- second: true
- },
- }
- },
-
- //..method
- //用于返回选择器选择的数据。
- confirmtime(e){
- console.log(e);
- //此处实现选择器值的接收
- this.time = e.year + '-' + e.month + '-'+
- e.day+' '+ e.hour + ':'+ e.minute + ':' + e.second;
- console.log(this.time);
- },
PS:有大佬知道如何解决只传入月、日、时、分吗?知道的大佬可以在评论区留言
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。