使用这个库:https://github.com/mozilla-services/react-jsonschema-form,我想添加一个日期选择器字段,文档中的内容如下:
date: By default, an input[type=date] element is used;
date-time: By default, an input[type=datetime-local] element is used.
他们发了这张照片,我希望我的照片和日期一样:
我使用最后一个版本的Chrome,以解决兼容性问题。
我试着写这样的东西:
date: {
type: "date",
title: "Date"
}
但我发现了一个错误:
字段root_date不支持的字段架构:未知字段类型日期。
检查这把小提琴:
发布于 2017-11-21 15:23:48
您应该将json定义为:
"datetime": { // whatever name you want
"type": "string", //Attention!
"format": "date-time"
},
而不是你所做的:
date: {
"type": "date",
"title": "Date"
}
react jsonschema-form库提供了非常好的游乐场:https://mozilla-services.github.io/react-jsonschema-form/。
https://stackoverflow.com/questions/47204422
复制相似问题