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');
}
}
});