1
一个hasOne模型我有一个模型横幅和模型BannerFormat。横幅有横幅格式。配置旗帜和横幅格式之间的hasOne关系,我写了这个:如何获得与煎茶触摸
Ext.define('admin.model.Banner', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'id', type: 'int' },
{ name: 'banner_format_id', type: 'int' },
'code',
'active',
'start_at',
'end_at'
],
associations: { type: 'hasOne', model: 'admin.model.BannerFormat', getterName: 'getBannerFormat' },
proxy: {
type: 'ajax',
url: '/admin/api_query.php',
extraParams: {
table: 'content_banners',
type: 'GET'
}
}
}
});
在我bannerFormat模型:
Ext.define('admin.model.BannerFormat', {
extend: 'Ext.data.Model',
config: {
fields: ['id', 'format'],
associations: { type: 'hasMany', model: 'admin.model.Banner' },
proxy: {
type: 'ajax',
url: '/admin/api_query.php',
extraParams: {
table: 'content_banner_formats',
type: 'GET'
}
}
}
});
但是,当我打电话banner.getBannerFormat(),我得到:
Uncaught TypeError: Object [object Object] has no method 'getBannerFormat'
我怎么会错呢?