Sencha Touch Cards布局无法正常工作

时间:2013-12-27 12:31:33

标签: extjs sencha-touch-2

我正在学习Sencha Touch2并尝试使用一个简单的应用程序来查看它是如何工作的。

我不知道我在这里做错了什么:https://fiddle.sencha.com/?fiddle=2da#fiddle/2da

1 个答案:

答案 0 :(得分:0)

0.-在你的小提琴中你使用ExtJs作为你的框架而不是Sencha Touch。

1.-当你从未宣布时,你试图使用'bolao.view.Main'

2.- Ext.fly('appLoadingIndicator').destroy();在Fiddle中遇到问题,但在服务器中正常使用时却没有。

3.-即使有了这些更改,我也无法在Chrome中看到它,但我确实在FireFox中看到了它。

4.-在您的小提琴中试用此代码,然后将其部署到您的Apache或您正在使用的任何服务器上。

5.-不要将小提琴用于学习目的(尽管显示代码很酷)。

6.-我建议您按照本教程http://docs.sencha.com/touch/2.3.1/#!/guide/first_app

进行操作

代码:

Ext.application({
    name: 'bolao',

    requires: [
        'Ext.MessageBox'
    ],

    views: [
        'Main'
    ],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/Icon@2x.png',
        '144': 'resources/icons/Icon~ipad@2x.png'
    },

    isIconPrecomposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },

    launch: function() {
        // Destroy the #appLoadingIndicator element
        //Ext.fly('appLoadingIndicator').destroy();  this line is having problems in Fiddle I think 'cos in my local server does work fine

        // Initialize the main view
        //Ext.Viewport.add(Ext.create('bolao.view.Main')); this view ('bolao.view.Main') is never defined
        Ext.Viewport.add(Ext.create('Ext.tab.Panel'));
    },

    onUpdated: function() {
        Ext.Msg.confirm(
            "Application Update",
            "This application has just successfully been updated to the latest version. Reload now?",
            function(buttonId) {
                if (buttonId === 'yes') {
                    window.location.reload();
                }
            }
        );
    }
});

最好的问候@ code4jhon