【问题标题】:meteor autoform string array shows empty field流星自动生成字符串数组显示空字段
【发布时间】:2015-07-25 17:34:40
【问题描述】:

我为一些集合制作了编辑表单,它有数组字段“电话”,每个元素都是字符串 当我尝试从该字段创建 afArrayField 时,它会显示带有一个空字符串的块

架构:

    {phones:
        {type: Array,
        minCount: 1,
        label: "Phones numbers"},
    {"phones.$":
        {type: String}
    }

模板:

    {{> afQuickField name="phones" value=phones}}

在对象数组中显示“电话”

【问题讨论】:

    标签: arrays meteor meteor-autoform


    【解决方案1】:

    我有以下:

      phones: {
        type: [String],
        minCount: 1,
        label: "Phones numbers"
      },
      'phones.$': {
        autoform: {
          afFieldInput: {
            type: 'text'
          }
        }
      }
    

    模板助手

    Template.home.helpers({
      doc: {phones: ['09988765', '0998776']} // this should come from db.findOne
    })
    

    在模板中:

    {{#autoForm id='test' schema="Schema.Array" type="update" doc=doc}}
      {{> afQuickField name="phones" value=doc.phones}}
    {{/autoForm}}
    

    我有这个:

    我有以下包依赖项:

    meteor-platform
    standard-app-packages
    iron:router
    iron:layout
    aldeed:collection2
    aldeed:simple-schema
    aldeed:autoform
    nemo64:bootstrap
    less
    accounts-base
    accounts-password
    

    【讨论】:

    • Meteor 说:错误:电话的定义无效。$ 字段
    • Oups,类型为:'text' ?
    • ReferenceError: text is not defined
    • 你有'周围的文字吗?类型:'文本'
    • 再次出现错误:电话的定义无效。$ 字段
    猜你喜欢
    • 1970-01-01
    • 2016-05-03
    • 1970-01-01
    • 2015-10-31
    • 2018-10-31
    • 1970-01-01
    • 1970-01-01
    • 2016-05-29
    • 1970-01-01
    相关资源
    最近更新 更多