當從2011年Senchacon在深度第一部分會議結束後煎茶觸摸MVC 2我一直從頭再來得到同樣的錯誤:在Sencha Touch 2中創建xtype?
Uncaught Error: [Ext.createByAlias] Cannot create an instance of
unrecognized alias: widget.homepage
Normaly在extjs4我會用別名:widget.homepage它工作得很好。但是,在煎茶觸摸MVC應用程序如下因素埃德斯賓塞的教程時,我不斷收到同樣的錯誤:
APP.JS
Ext.Loader.setConfig({
enabled:true
});
Ext.application({
name: 'Sencha',
controllers: ['Main'],
launch: function() {
Ext.create("Ext.tab.Panel", {
fullscreen: true,
tabBarPosition: 'bottom',
items: [
{
xtype: 'homepage'
}
]
});
}
});
視圖(HOME.JS)
Ext.define('Sencha.view.Home', {
extend: 'Ext.Panel',
xtype: 'homepage',
config: {
title: 'Home',
iconCls: 'home',
cls: 'home',
html: [
'<img src="http://staging.sencha.com/img/sencha.png" />',
'<h1>Welcome to Sencha Touch</h1>',
"<p>You're 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("");
}
});
控制器(MAIN.JS)
Ext.define('Sencha.controller.Main', {
extend: 'Ext.app.Controller',
views: ['Home'],
init: function() {
console.log('inited');
}
});
我有同樣的'未捕獲的錯誤:[Ext.createByAlias]無法創建無法識別的別名的實例:widget.somename',但我通過在ext.application的主視口之前聲明內部視圖來修復,如下所示:'views :['someViewWithXtype','anotherViewWithXtype','myViewport'],' – RaphaelDDL 2012-03-06 18:21:36