如何在jsonschema-form lib中的无线电输入之前添加图像?

时间:2018-02-09 12:07:46

标签: javascript image reactjs radio-button jsonschema

我正在使用jsonschema-form lib,我想在收音机输入之前添加图片。

此图片是最终结果的示例:

enter image description here

我的JSONSchema是:

"type": "object",
"title": "Title",
"properties": {
   "turni": {
      "type": "string",
      "format": "radio",
      "enum": ["optA", "optB", "optC"],
      "enumNames": ["a", "b", "c"],
      "images":["url-a", "url-b", "url-c"]
   }
}

如何为我的purpouse定制收音机小部件?

1 个答案:

答案 0 :(得分:2)

我以这种方式解决了这个问题:

"turns": {
    "type": "string",
    "represents": "turns",
    "enum": "option1", "option2", "option3"],
    "enumNames": ["a", "b", "c"],
    "uniqueItems": true,
    "imgs":["data:image/png;base64,...", 
            "data:image/png;base64,...",
            "data:image/png;base64,..."
           ]
    }