【发布时间】:2014-01-02 13:27:16
【问题描述】:
我是 Sencha Touch 的新手,我正在尝试开发一个包含 用户注册 视图和 用户登录 视图的应用程序。
主视图有一个登录按钮和一个注册按钮。
我想要完成的是更改视图以响应被点击的按钮。
以下是我正在使用的代码:
Ext.define('MyApp.controller.RegisterForm', {
extend: 'Ext.app.Controller',
requires: ['Ext.data.JsonP'],
config: {
refs: {
mainPage: 'mainpage',
loginForm: 'loginform',
registerForm: 'registerform'
},
control: {
'button[action=UserNewAccount]': {
tap: 'onNewAccount'
},
}
},//config
/**
* respond when new account is requested
*/
onNewAccount: function(event){
/**
* I have tried this ...
*/
this.getLoginForm().add(this.getRegisterForm());
this.getLoginForm().setActiveItem(this.getRegisterForm());
/**
* ... and this
*/
this.getLoginForm().setActiveItem({
xtype: 'registerform'
});
console.log('New account requested: ');
}
});
onNewAccount 函数反应良好。 console.log 调用执行。问题是上面的代码。我已经尝试了这两种不同的方法,但没有成功。
谁能告诉我我做错了什么以及如何改变我的观点?
【问题讨论】:
标签: sencha-touch-2