Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sencha触摸标签处理程序_Javascript_Extjs_Sencha Touch - Fatal编程技术网

Javascript Sencha触摸标签处理程序

Javascript Sencha触摸标签处理程序,javascript,extjs,sencha-touch,Javascript,Extjs,Sencha Touch,我试图在Sencha Touch中创建一个Tabpanel,并向其中一个按钮添加一个处理程序,但当我单击它时,事件不会触发。有什么想法吗 代码如下: 处理程序: var handler = function(button, event) { var txt = "YES!"; alert(txt); }; 以及该项目: items: [{ xtype: 'button', title: 'Test', ht

我试图在Sencha Touch中创建一个Tabpanel,并向其中一个按钮添加一个处理程序,但当我单击它时,事件不会触发。有什么想法吗

代码如下:

处理程序:

var handler = function(button, event) {
        var txt = "YES!";
        alert(txt);
    };
以及该项目:

items: [{
        xtype: 'button',
        title: 'Test',
        html: 'Test',
        iconCls: 'info',
        cls: 'card1',
        handler: handler
    }]
在项目后添加:

listeners: {
        cardswitch : function() {
          console.log('cardswitch!');
        }
}

请参阅文档

了解您的具体情况,如果您希望仅在一个选项卡的情况下触发事件,您可以侦听该选项卡的
激活
事件:

items: [{
        xtype: 'button',
        title: 'Test',
        html: 'Test',
        iconCls: 'info',
        cls: 'card1',
        listeners: {
            activate : function() {alert("bam!")}
        }
    }]