2017-07-15 71 views
1

我從collection2更新爲[email protected]。刪除了流星包​​並添加了NPM版本simpl-schema。我正在使用aldeed:[email protected] 現在我的模式中的autoform字段不起作用。MeteorJS - 錯誤:「autoform」不是受支持的屬性

我該怎麼辦?

這是我的架構:

Articulos.schema = new SimpleSchema({ 
    _id: { 
    type: String, 
    regEx: SimpleSchema.RegEx.Id, 
    optional: true 
    }, 
    nombre: { 
    type: String, 
    label: 'Nombre', 
    }, 
    area: { 
    type: String, 
    label: 'Area', 
    autoform: { 
     firstOption: "Seleccione un area", 
     options() { 
     var areas = Areas.find({}).fetch(); 
     const areasOpt = areas.map((a) =>{ 
      return { 
      label: a.nombre, 
      value: a.nombre 
      } 
     }); 
     return areasOpt; 
     } 
    } 
    }, 
} 

完整的錯誤是:

Error: Invalid definition for area field: "autoform" is not a supported property 
at /home/francisco/Proyectos/simple-stock/node_modules/simpl-schema/dist/SimpleSchema.js:991:13 
at Function._.each._.forEach (/home/francisco/Proyectos/simple-stock/node_modules/underscore/underscore.js:158:9) 
at checkAndScrubDefinition (/home/francisco/Proyectos/simple-stock/node_modules/simpl-schema/dist/SimpleSchema.js:989:24) 
at /home/francisco/Proyectos/simple-stock/node_modules/simpl-schema/dist/SimpleSchema.js:500:9 
at Function._.each._.forEach (/home/francisco/Proyectos/simple-stock/node_modules/underscore/underscore.js:158:9) 
at SimpleSchema.extend (/home/francisco/Proyectos/simple-stock/node_modules/simpl-schema/dist/SimpleSchema.js:488:28) 
at new SimpleSchema (/home/francisco/Proyectos/simple-stock/node_modules/simpl-schema/dist/SimpleSchema.js:109:10) 
at meteorInstall.imports.api.articulos.articulos.js (imports/api/articulos/articulos.js:18:20) 
at fileEvaluate (packages/modules-runtime.js:333:9) 
at require (packages/modules-runtime.js:228:16) 

回答

0

我找到了答案。必須添加以下行:

SimpleSchema.extendOptions(['autoform']); 
相關問題