0

我有这段代码,我想选择每个部分的标签,因为它们是使用代码自动生成的。如果我将“WineName”选择为“Wine Name”,则不会发生任何事情。

var type = t.enums({
   type1: 'Red',
   type2: 'Rosé',
   type3: 'White'
});    
var FichaUm = t.struct({
    WineName: t.String,
    harvest: harvest,
    type: type,
    producername: t.String,
    country: country,
    zone: t.String
});
4

2 回答 2

0

您应该能够创建一个选项对象并将其传递给表单,它将是这样的:

let options = {
  fields: {
    "sectionName": {
      label: "your label"
    }
  }
}

然后在表单元素上

<Form type={FichaUm} options={options}/> 
于 2018-04-24T11:28:07.637 回答
0

要使用带空格的对象属性,可以使用括号表示法来设置对象属性。考虑以下片段

var FichaUm = t.struct({
 ['Wine Name']: t.String,
 harvest: harvest,
 type: type,
 producername: t.String,
 country: country,
 zone: t.String
});

希望这会有所帮助!

于 2018-04-03T18:54:18.237 回答