关于javascript:在Sencha Touch 2.4.0 中实现路由 | 珊瑚贝

Implement routing in Sencha Touch 2.4.0


我正在尝试在 Sencha Touch 2.4.0 中实现路由,但无法在路由更改事件中触发函数。我有一个主控制器-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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

1
2
3
4
5
6
7
views: [
        ‘Main’
    ],

    models: [],
    controllers: [‘Main’],
    stores: [],

正在尝试-

1
2
Ext.Viewport.add(Ext.create(‘STPG.view.Main’));
this.redirectTo(‘home’);

它没有调用那个函数。


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


来源:https://www.codenong.com/27440473/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9583.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?