Error: C2008: Requirement had no matching files (ExtReactModels.model.Item) in ExtReact

Error: C2008: Requirement had no matching files (ExtReactModels.model.Item) in ExtReact

因此,我正在尝试使用架构和命名空间连接模型,但出现此错误:“错误:C2008:要求没有匹配的文件 (ExtReactModels.model.Item)”。这是在 ExtReact 中完成的。我应该声明架构和命名空间,还是只导入普通对象?代码中最重要的部分是:

  1. 根类型模型:

export default Ext.define("ExtReactModels.model.RootType", {
 extend: 'Ext.data.Model',
 schema: {
  namespace: 'ExtReactModels.model'
 },
 requires: [
  'Ext.data.proxy.Rest', 'ExtReactModels.model.Item'
 ],
 idProperty: 'rootTypeId',
 fields: [
  /* ... */
 ],
 proxy: {
  type: 'rest',
  url: '/rootTypes'
 },
 hasOne: [{
  model: 'ExtReactModels.model.Item', name: 'item', associationKey: ">item", instanceName:"item",
  getterName: "getItem", setterName: "setItem"
 }]
});

  1. 物品型号:

export default Ext.define("ExtReactModels.model.Item", {
 extend: 'Ext.data.Model',
 schema: {
  namespace: 'ExtReactModels.model'
 }
 requires: [
  'Ext.data.proxy.Rest'
 ],
 idProperty: 'itemId',
 fields: [
  /* ... */  
 ],
 proxy: {
  type: 'rest',
  url: '/items'
 },
 hasOne: [{
  model: 'ExtReactModels.model.Application', name: 'application', associationKey: ">application", instanceName:"application",
  getterName: "getApplication", setterName: "setApplication"
 }]
});

所以我通过使用为 Item 导入的普通对象修复了这个问题,我还定义了单独的常量,它将保存模式和命名空间的定义,并将在单独的模型中重复,现在我可以使用这个在不同型号中的定义:

import itemModel from './ItemModel';
import {baseModel} from './BaseModel';

export default Ext.define("ExtReactModels.model.RootType", {
 extend: 'Ext.data.Model',
 baseModel,
 requires: [
  'Ext.data.proxy.Rest'
 ],
 idProperty: 'rootTypeId',
 fields: [
  /* ... */
 ],
 proxy: {
  type: 'rest',
  url: '/rootTypes'
 },
 hasOne: [{
  model: itemModel, name: 'item', associationKey: ">item", instanceName:"item",
  getterName: "getItem", setterName: "setItem"
 }]
});

如果有人为此找到了不同的方法,请告诉我!