因此,我正在尝试使用模式和命名空间连接模型,但出现此错误:“错误:C2008:需求没有匹配的文件(ExtReactModels.model.Item)”。这是在 ExtReact 中完成的。我应该声明模式和命名空间,还是只导入普通对象?代码中最重要的部分是:
- 根类型模型:
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"
}]
});
- 产品型号:
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"
}]
});