我想示例代碼將有助於你:
Ext.define('MyApp.view.LoginSiteContainer', {
extend: 'Ext.form.Panel',
alias: 'widget.loginsitecontainer',
config: {
id: 'loginform',
url: 'som_url',
items: [
{
xtype: 'container',
layout: {
type: 'vbox'
},
items: [
{
xtype: 'fieldset',
instructions: 'Login using existing account. Password is case sensitive.',
title: 'Login details',
items: [
{
xtype: 'textfield',
id: 'login',
itemId: 'login',
label: 'Login'
},
{
xtype: 'passwordfield',
id: 'password',
itemId: 'password',
label: 'Password'
}
]
},
{
xtype: 'panel',
layout: {
type: 'hbox'
},
items: [
{
xtype: 'button',
id: 'Login',
itemId: 'Login',
margin: '0.1em',
ui: 'confirm',
text: 'Login',
flex: 1
}
]
}
]
}
],
listeners: [
{
fn: 'onLoginTap',
event: 'tap',
delegate: '#Login'
}
]
},
onLoginTap: function(button, e, options) {
// login function here
}
});