【发布时间】:2021-08-10 00:30:47
【问题描述】:
如何根据 React Json Schema 中另一个字段的变化来更新一个字段?下面是我的架构对象。
为了简化用例,假设我将“国家/地区”下拉字段默认设置为“加拿大”,“货币”文本字段为空。如果国家/地区发生变化,货币文本字段应显示新元。
{
type: 'object',
properties: {
country: {
title: 'Country',
type: 'string',
enum: ['Canada', 'Singapore', ..., 'United States'],
default: 'Canada',
},
currency: {
type: 'string',
default: '',
},
},
dependencies: {
country: {
properties: {
currency: {
const: 'SG',
},
},
},
},
}
【问题讨论】:
标签: jsonschema react-jsonschema-forms