Sencha Touch Label - does it have a Tap Event?

醉酒当歌 提交于 2019-12-04 07:34:27

You can do this :

label.element.on({
    tap : function(e, t) { ... }
});

Hope this helps

one more way to bind the tap event to the 'label' control using sencha touch.

{
    xtype : 'label',
    html : 'my name is abc',
    listeners : 
    {
        element : 'element',
        tap : function(e, t) 
         {
           alert('1 pressed');
         }
    }
}

Ext.Label is not designed to have a tap event. However, you can still achieve it through the tap event on your label HTML element, for example:

label.getContentEl().on{'tap', handler_function,this}

But Sencha Touch does not provide tap event on Ext.Label, which is a child of Ext.Component, so when you try to use tap event on a label, it's not the best practice.

A better approach is to use Ext.Button with the following 2 configs:

{
  ui: 'plain',
  cls: 'btnCls',
}

and in your CSS, style its background to transparent.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!