我是sencha touch的新手,这是我的第一个应用程序。我的应用程序是登录& SignUp页面。当我点击SignUp按钮时,它无法加载。我在一个页面中创建了两个文本框字段和两个按钮。用户名和密码的文本框以及登录注册按钮。 我的观点代码
Ext.define('MyApp.view.Login', {
extend: 'Ext.form.Panel',
alias: "widget.loginview",
requires: ['Ext.form.FieldSet', 'Ext.form.Password', 'Ext.Label', 'Ext.Img', 'Ext.util.DelayedTask'],
config: {
title: 'Login',
items: [
{
xtype: 'label',
html: 'Login failed. Please enter the correct credentials.',
itemId: 'signInFailedLabel',
hidden: true,
hideAnimation: 'fadeOut',
showAnimation: 'fadeIn',
style: 'color:#990000;margin:5px 0px;'
},
{
xtype: 'fieldset',
title: 'Login Example',
items: [
{
xtype: 'textfield',
placeHolder: 'Username',
itemId: 'userNameTextField',
name: 'userNameTextField',
required: true
},
{
xtype: 'passwordfield',
placeHolder: 'Password',
itemId: 'passwordTextField',
name: 'passwordTextField',
required: true
}
]
},
{
xtype: 'button',
itemId: 'logInButton',
ui: 'action',
padding: '10px',
text: 'Log In'
},
{
xtype: 'button',
itemId: 'singupButton',
ui: 'action',
padding: '10px',
text: 'Sign Up'
}
],
listeners: [{
delegate: '#logInButton',
event: 'tap',
fn: 'onLogInButtonTap'
},
{
delegate: '#signUpButton',
event: 'tap',
fn: 'onSignUpButtonTap'
}
]
},
onSignUpButtonTap: function () {
},
onLogInButtonTap: function () {
var me = this,
usernameField = me.down('#userNameTextField'),
passwordField = me.down('#passwordTextField'),
label = me.down('#signInFailedLabel'),
username = usernameField.getValue(),
password = passwordField.getValue();
label.hide();
// Using a delayed task in order to give the hide animation above
// time to finish before executing the next steps.
var task = Ext.create('Ext.util.DelayedTask', function () {
label.setHtml('');
me.fireEvent('signInCommand', me, username, password);
usernameField.setValue('');
passwordField.setValue('');
});
task.delay(500);
},
showSignInFailedMessage: function (message) {
var label = this.down('#signInFailedLabel');
label.setHtml(message);
label.show();
}
});
我知道有错误的代码。请帮助我......
答案 0 :(得分:1)
在点击事件上编写此代码,以便从登录到注册。
objView.destroy();
Ext.Viewport.animateActiveItem({
xtype: viewName
}, {type: "slide", direction: "left"});
其中objView是登录视图(this)的指针,viewName是具有注册视图xtype的字符串。