Sencha Touch 2.0 xtype无法正常工作

时间:2012-03-12 19:08:22

标签: extjs sencha-touch-2

尝试跟随视频http://docs.sencha.com/touch/2-0/#!/guide/getting_started,但是一旦它到达添加xtypes将所有内容放在一起大约3分钟的部分。我无法让xtype正常工作,这是什么我有我的Main.js

Ext.define("GS.view.Main", {
    extend: 'Ext.tab.Panel',
    requires: ['Ext.TitleBar'],

    config: {
            tabBarPosition: 'bottom',

            items:[
                    {
                    xtype: 'homepanel',
                    }
    ]
    }
});

这就是我在Home.js文件中的内容

Ext.define("GS.view.Home", {
    extend: 'Ext.tab.Panel',
    requires: ['Ext.TitleBar'],
    xtype: 'homepanel',

    config: {
    tabBarPosition: 'bottom',

    items: [
        {
            title: 'Welcome',
            iconCls: 'home',
            cls:'home',
            styleHtmlContent: true,
            scrollable: true,



            html: [
                '<img src="http://staging.sencha.com/img/sencha.png" />',
                '<h1>Welcome to Sencha Touch</h1>',
                "<p>You'rebbb creating the Getting Started app. This demonstrates how ",
                "to use tabs, lists and forms to create a simple app</p>",
                '<h2>Sencha Touch (2.0.0)</h2>'
            ].join("")
        }]
    }
});

在app.js中我有这个

views: [ 'Main', 'Home', 'Contact' ],

我完全按照视频做了什么,也许我错过了什么?提前感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

您需要在类定义中使用alias属性。

Ext.define("GS.view.Home", {
    extend: 'Ext.tab.Panel',
    requires: ['Ext.TitleBar'],
    alias: 'widget.homepanel',

    config: {
        tabBarPosition: 'bottom',
        items: [{
             title: 'Welcome',
             iconCls: 'home',
             cls:'home',
             styleHtmlContent: true,
             scrollable: true,
             html: [
                '<img src="http://staging.sencha.com/img/sencha.png" />',
                '<h1>Welcome to Sencha Touch</h1>',
                "<p>You'rebbb creating the Getting Started app. This demonstrates how ",
                    "to use tabs, lists and forms to create a simple app</p>",
                    '<h2>Sencha Touch (2.0.0)</h2>'
            ].join("")
        }]
    }
});

答案 1 :(得分:0)

这可能是因为您正在尝试扩展:Home.js中的Ext.tab.Panel。

这样做会使您在选项卡面板中添加选项卡面板。

尝试扩展:'Ext.Panel',在你的Home.js中应该做或者你也可以使用

extend:'Ext.Container',

相关问题