0
我試圖建立一個localStorage的拯救從我的REST服務接收到的認證令牌,但不幸的是我不斷收到錯誤有關商店功能不存在:無法調用getStore在SECHA觸摸應用
TypeError: Ext.getStore is not a function
var test = Ext.getStore('myPhysioStorage');
我實現:
店/ UserStore.js
Ext.define('Physio.model.UserStore'), {
extend: 'Ext.data.Model',
config: {
fields: [
'sessiontoken'
]
}
});
模型/ UserStore.js
Ext.define('Physio.store.UserStore'), {
extend: 'Ext.data.Store',
requires: 'Physio.model.UserStore',
config: {
model: 'Physio.model.UserStore',
autoload: true,
storeId: 'myPhysioStorage',
proxy: {
type: 'localStorage',
id: 'myPhysioStorageProxy'
}
}
});
控制器/ Login.js
...
launch: function() {
var test = Ext.getStore('myPhysioStorage');
console.log(userStore);
}
...
app.js
Ext.application({
name: 'Physio',
views: ['Login','MainMenu'],
controllers:['Login','MainMenu'],
store:['UserStore'],
model:['UserStore'],
launch: function() {
Ext.Viewport.add([
{ xtype: 'loginview' },
{ xtype: 'mainmenuview' }
]);
}
});
'app.js'中缺少'require'。 – JavaCake
那麼如果你的問題解決了,你可以將我的答案標記爲已接受。 – Niklas