0
我已經通過sencha命令行構建了我的項目,但在構建特定控制器的偵聽器事件後無法工作。我包含在監聽器中的警報沒有被調用。我的主要問題是,標籤「告訴你的朋友」後面的localStorage.providerName有時打印未定義,因此試圖在偵聽器中實現,但偵聽器中的函數未被調用。有什麼建議麼?以下是事件監聽器不被調用的代碼部分。通過sencha構建偵聽器事件不會觸發
Ext.define('Myl.view.ShareView', {
extend: Ext.Panel,
id:'shareView',
xtype :'shareView',
alias: 'widget.shareView',
config: {
cls:'mainBackground',
items: [
{
xtype:'toptoolbar',
docked:'top'
},
{
xtype: 'label',
id: 'tellAFriendTopLabel',
// html: 'Tell your friends about '+localStorage.providerName,
padding: 5
},
{
xtype: 'button',
margin: 20,
text: 'Facebook',
ui:'facebook_button',
iconCls:'facebookIconCls',
action : 'facebookButtonPressed'
},
{
xtype: 'button',
margin: 20,
text: 'Twitter',
iconCls:'twitterIconCls',
ui:'twitter_button',
action : 'twitterButtonPressed'
},
{
xtype: 'button',
margin: 20,
text: 'Email',
ui:'email_button',
iconCls:'emailIconCls',
action : 'emailButtonPressed'
},
{
xtype :'footerPanel',
docked:'bottom'
}
]
},
listeners: {
painted: function (element, options) {
alert('test1');
Ext.getCmp('tellAFriendTopLabel').setHtml('Tell your friends about '+localStorage.providerName+'.');
this.fireEvent('initiateShareView');
}
}
});