【发布时间】:2019-05-07 13:59:26
【问题描述】:
我是 extjs 新手,我正在尝试参数化商店代理 url。
在我看来,我正在建造这样的商店:
store: Ext.create('mystore', {
partofurl: 'url'
})
还有我的商店:
Ext.define('mystore', {
extend: 'Ext.data.Store',
alias: 'store.mystore',
model: 'mymodel',
restful: true,
autoLoad: true,
proxy: {
type: 'ajax',
headers: {
'Accept': '*/*',
'Cache-Control': 'no-cache',
'Content-Type': 'application/json',
'Authorization': localStorage.token
},
reader: {
type: 'json',
rootProperty: 'data',
successProperty: 'success'
},
writer: {
type: 'json',
writeAllFields: true,
encode: true,
rootProperty: 'data'
},
actionMethods: {
read: 'GET'
},
api: {
read: 'http://url' + this.partofurl,
create: 'http://url' + this.partofurl,
update: 'http://url' + this.partofurl,
destroy: 'http://url' + this.partofurl,
},
autoSave: true
}
});
我也试过这个:
store: Ext.create('mystore', {
proxy.api.read = 'http://url' + partofurl
})
等等……但它一直在告诉我:
未捕获的错误:您正在使用 ServerProxy,但尚未为其提供 url。
我该如何解决这个问题?
【问题讨论】:
标签: extjs