gpt4 book ai didi

javascript - 在 Sencha Touch 2.4.0 中实现路由

转载 作者:行者123 更新时间:2023-12-03 11:13:42 25 4
gpt4 key购买 nike

我正在尝试在 Sencha Touch 2.4.0 中实现路由,但无法在路由更改事件上触发功能。我有一个主 Controller -

Ext.define('STPG.controller.Main', {
extend: 'Ext.app.Controller',

routes : {
'home' : 'onHome'
},

config: {
refs: {

},
control: {

}
},

//called when the Application is launched, remove if not needed
launch: function(app) {

},
onHome : function() {
console.log('home controller called');
}
});

app.js

views: [
'Main'
],

models: [],
controllers: ['Main'],
stores: [],

正在尝试-

Ext.Viewport.add(Ext.create('STPG.view.Main'));
this.redirectTo('home');

它没有调用该函数。

最佳答案

你犯了一个愚蠢的错误。只需将您的 routes: {} 放入 config 中即可。你的问题解决了。快乐编码!

关于javascript - 在 Sencha Touch 2.4.0 中实现路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27440473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com