1
我試圖在工具欄中點擊「登錄」時切換面板。 我的控制器獲取事件,並通過添加和設置活動項目到我想要的面板來切換。但是,屏幕保持空白(並且沒有調試錯誤)。面板不顯示sencha touch 2
這是我的面板的代碼,任何想法可能是什麼錯誤?
Ext.define('App.view.LoginView', {
extend: 'Ext.Panel',
xtype: 'loginpanel',
alias: 'widget.loginView',
fullscreen: true,
layout: 'fit',
items: [
{
xtype: 'TopToolBar'
},
{
xtype: 'formpanel',
items: [
{
xtype: 'fieldset',
title: 'Login',
instructions: 'Have a great day!',
items: [
{
xtype: 'emailfield',
name: 'email',
label: 'Email'
},
{
xtype: 'passwordfield',
name: 'password',
label: 'Password'
}
]
},
{
xtype: 'button',
text: 'Login',
ui: 'confirm',
handler: function()
{
this.up('loginpanel').submit();
}
}
]
}]})
我的工具欄類的代碼:
Ext.define('App.view.TopToolBar', {
extend: 'Ext.Toolbar',
xtype: 'TopToolBar',
dock: 'top',
initialize: function() {
var loginButton = {
xtype: 'button',
text: 'Login',
ui: 'action',
handler: this.onLoginTap,
scope: this
};
this.add(loginButton);
},
onLoginTap: function(){
console.log('login tap');
this.fireEvent('loginBtnHandler', this);
}})
什麼時候屏幕會空白?當你按下按鈕或當你嘗試執行代碼?它看起來像你只定義類而不是實例化它們。 – A1rPun
確實,那是問題所在,我沒有將它們實例化;)thx! (我還必須給組件佈局) –
我應該回答問題,以便您可以接受它嗎?它更適合你,這個網站和我:) – A1rPun