0

我刚开始在我的Meteor Mantra Kickstarter中使用Vazco “制服”,但我遇到了一个难以解决的难题:

<section class="field form-group">
  <label for="uniforms-0000-0002" class="control-label">
    Content
  </label>
  <textarea class="form-control" id="uniforms-0000-0002" name="content" placeholder="">
  </textarea>
</section>

textarea例如,我的表单上所有其他类型的字段都是不可写的

我可能会犯一些错误,导致我无法写入表单中的字段吗?

它的 JSX 看起来像这样:

<BaseForm disabled={false}  placeholder={false} schema={this.bridge} >
  <div className="row-fluid">
    <div className="col-md-4">
      <NumField grid={6} name="pages" label="# Pages" value="0"/>
      <TextField name="title" label="Title" />
    </div>
    <div className="col-md-8">
      <LongTextField name="content" label="Content"
                     disabled={false} placeholder={false} />
     </div>
  </div>
  <ErrorsField />
 </BaseForm>

我这样设置桥接定义:

            : 
            : 
  this.schemaType = API_AST.getType('Book');

  this.schemaValidator = model => {
    const details = [];
  };

  this.schemaData = {
  };

  console.log("Book schema : ", this.schemaType);
  console.log("Schema validator : ", this.schemaValidator);
  console.log("Schema data : ", this.schemaData);

  this.bridge = new GraphQLBridge(
                         this.schemaType
                       , this.schemaValidator
                       , this.schemaData
  );
  console.log("The bridge : ", this.bridge);
}

各种console.log( "..." )说明显示:

Book schema :  GraphQLObjectType
     _fields:  Object
        _id:  Object
        author:  Object
        content:  Object
        pages:  Object
        title:  Object
        __proto__: Object
    _interfaces: Array[0]
    _typeConfig: Object,
        description: ""
        isTypeOf: undefined,
        name: "Book",
    __proto__: Object

... 然后 ...

Schema validator :  function (model) {             // 39
  var details = [];

... 然后 ...

Schema data :  Object
                __proto__: Object

... 然后 ...

The bridge :  GraphQLBridge
                 extras: Object
                 schema: GraphQLObjectType
                   _fields: Object
                     _id: Object
                     author: Object
                     content: Object
                     pages: Object
                     title: Object
                     __proto__: Object
                   _interfaces: Array[0]
                   _typeConfig: Object
                      description: ""
                      isTypeOf: undefined
                      name: "Book"
                    __proto__: Onject
                 validator: (model)
                 __proto__: Bridge

如果这里的列表不足,请告诉我。

4

1 回答 1

0

它是可写的,但你没有用它做任何事情。根据此处的文档,BaseForm必须以与字段相同的方式使用,其中model的值和onChange是......onChange当然。您可能想自己使用AutoForm或处理表单 - 自述文件中的示例很少。

于 2017-01-31T20:44:26.363 回答