在此示例中,我对更改卡片的语法有点不清楚。我已经尝试对面板进行引用,但这没有用。我想使用底部由提交按钮触发的 onButton 函数来切换卡片(只是一个按钮 - 在本示例中并未真正用作表单)
Ext.application({
name: 'Sencha',
main: null,
refs: [
{
ref: "main",
selector: "mypanel"
}
],
init: function() {
this.control({
'#switch': {
tap: this.onButton
},
})
},
launch: function() {
this.main = Ext.create("Ext.Panel", {
fullscreen: true,
layout: 'card',
xtype: 'mypanel',
items: [
{
title: 'Home',
iconCls: 'home',
cls: 'home',
html: 'home page',
},
{
title: 'Contact',
iconCls: 'user',
xtype: 'formpanel',
url: 'contact.php',
layout: 'vbox',
items: [
{
xtype: 'fieldset',
title: 'Contact Us',
instructions: '(email address is optional)',
items: [
{
xtype: 'textfield',
label: 'Name'
},
{
xtype: 'emailfield',
label: 'Email'
},
{
xtype: 'textareafield',
label: 'Message'
}
]
},
{
xtype: 'button',
itemId: 'switch',
id: 'switch',
text: 'Send',
ui: 'confirm',
}
]
}
]
});
this.main.setActiveItem(1);
},
onButton: function() {
//? how do I switch from here
}
});
提前致谢