【发布时间】:2014-06-29 12:11:34
【问题描述】:
我已经阅读了SO question: Controller for Buttons Sencha Touch 2 [Solved] 来实现点击按钮。有效!
不幸的是,我需要点击容器,而不是按钮。一旦我将xtype:'container' 更改为xtype:'button',它点击正常,我看到console.log 消息,所以一切正常。一旦我将它改回xtype:'container',它就会停止工作,没有console.log 消息。
所以,我的问题是:如何让点击事件为我的xtype:'container' 工作?为什么它只适用于按钮?我错过了什么吗?
附:据我所知,容器没有点击事件。那有什么解决办法呢?将按钮制作为具有多个文本字符串和背景的解决方案吗?
好的,根据您的回答,目前还不清楚如何使按钮看起来像容器。容器是一个上面有两个字符串的图像。这是我的容器:
{
xtype:'container',
cls:'home-img',
id: 'home-img',
layout : {
type : 'vbox',
align: 'middle'
},
items:[
{ xtype:'container',
html:'Your current rate is:'
},
{ xtype:'container',
tpl:'{rate}'
}
],
},
将xtype:'container' 替换为xtype:'button' 后,我很难显示{rate} 参数并且无法生成两个字符串。
【问题讨论】:
标签: events sencha-touch sencha-touch-2 containers tap