Sencha touch 2 如何使用视图通过MVC在Sencha Touch 2.0中放置按钮
我尝试过这样一个简单的MVC示例。 没关系,但假设我想使用视图在面板中添加一个按钮 我已经试着做了如下的事情 app.js:Sencha touch 2 如何使用视图通过MVC在Sencha Touch 2.0中放置按钮,sencha-touch-2,Sencha Touch 2,我尝试过这样一个简单的MVC示例。 没关系,但假设我想使用视图在面板中添加一个按钮 我已经试着做了如下的事情 app.js: Ext.Loader.setConfig({enabled: true}); Ext.application({ name: 'rpc', appFolder: 'app', controllers: ['Home'], launch: function () { Ext.create('Ext.tab.Panel',{
Ext.Loader.setConfig({enabled: true});
Ext.application({
name: 'rpc',
appFolder: 'app',
controllers: ['Home'],
launch: function () {
Ext.create('Ext.tab.Panel',{
fullscreen: true,
tabBarPosition: 'bottom',
items:[{
title: 'Home',
iconCls: 'home',
html: '<img src="http://staging.sencha.com/img/sencha.png" />'
},{
title: 'Compose',
iconCls: 'compose',
xtype: 'mybutton'
}]
});
}
});
看法
我收到的结果是:
未捕获的TypeError:无法读取未定义的属性“length”
错误在哪里?在Sencha Touch 2.0中使用MVC视图添加按钮的正确方法是什么
谢谢。尝试更改定义rpc.view.home.Button视图的方式,我在视图中不调用initialize(),我只调用:
Ext.define('rpc.view.home.Button', {
extend: 'Ext.Panel',
xtype: 'mybutton',
config: {
items = [
{
xtype: 'button',
cls : 'demobtn',
flex : 1
}
]
}
});
尝试更改定义rpc.view.home.Button视图的方式,我不在视图中调用initialize(),我只调用:
Ext.define('rpc.view.home.Button', {
extend: 'Ext.Panel',
xtype: 'mybutton',
config: {
items = [
{
xtype: 'button',
cls : 'demobtn',
flex : 1
}
]
}
});
Ext.define('rpc.view.home.Button', {
extend: 'Ext.Panel',
xtype: 'mybutton',
config: {
items = [
{
xtype: 'button',
cls : 'demobtn',
flex : 1
}
]
}
});