【问题标题】:Sencha touch Error: Uncaught Error The following classes are not declared even if their files have been loaded: 'Ext.data.model'Sencha touch 错误:未捕获的错误即使文件已加载,也未声明以下类:'Ext.data.model'
【发布时间】:2014-05-06 08:33:33
【问题描述】:

“未捕获的错误:即使文件已加载,也未声明以下类:'Ext.data.model'。请检查其对应文件的源代码是否存在拼写错误:'touch/src/data/model .js"

我收到了这个错误,我不知道为什么会产生这个错误。这是我的代码看看,因为我已经转动了每一块石头但仍然没有答案。似乎我在几个小时内编写代码的每个时间都用来找出 sencha touch 出了什么问题

App.js

//<debug>
Ext.Loader.setPath({
    'Ext': 'touch/src',
    'TutsPlus': 'app'
});
//</debug>

Ext.application({
    //http://docs.sencha.com/touch/2-1/#!/api/Ext.app.Application
    name: 'TP',

    views: ['Main'],
    models: ['mtask'],
    stores: ['stask'],

    launch: function() {
        // Destroy the #appLoadingIndicator element
        Ext.fly('appLoadingIndicator').destroy();

        // Initialize the main view
        Ext.Viewport.add(Ext.create('TP.view.Main'));
    }

});

在 Store stask.js

    Ext.define('TP.store.stask', {
    extend: 'Ext.data.Store',

    config: {
        //Define which model we are going to use for our store
        model: 'TP.model.mtask',
        data: [
            {label: 'Make the change'},
            {label: 'Take the trash'},
            {label: 'Clear the room'},
            {label: 'Wake Up Early'}
        ]

    }
});

在模型 mtask.js 中

Ext.define('TP.model.mtask', {
    extend: 'Ext.data.Model',

    config: {

        fields: [
            {name: 'label', type: 'string'},
            {nae: 'done', type: 'boolean', defaultValue: false}
        ]
    }

});

在视图文件夹 Main,js

Ext.define('TP.view.Main', {
    extend: 'Ext.Panel',
    xtype: 'main',

    requires: [
        'Ext.TitleBar',
        'Ext.dataview.List'
    ],

    config: {
        layout: 'vbox',
        items: [
            {
                docked: 'top',
                xtpe: 'titlebar',
                title: 'Note Taker',
                items: [
                    {
                        iconCls: 'add',
                        iconMask: true,
                        align: 'right',
                        id: 'add-button'
                    }
                ]
            },
            {
                xtype: 'list',
                store: 'stask'





            }
        ]
    }
});

【问题讨论】:

  • Ext.data.*M*odel。案件很重要。
  • 我实际上写了 Ext.data.Model,正如你在模型文件夹中看到的那样,我也尝试使用小写,但它不起作用。

标签: extjs sencha-touch-2


【解决方案1】:

由于某种原因,您的模型类没有被声明。尝试找出语法错误和案例的原因。 尝试改变:

nae: 'done'name: 'done'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多