1

我在 Sencha Touch 2 中遇到问题。我想在单击另一个图像时隐藏一个图像。我怎样才能做到这一点?

items: [{
  xtype: 'panel',
  html: '<img class="logo0" src="http://localhost/PlanningPoker/resources/images/carte0.png" /> '+
        '<img class="logo1" src="http://localhost/PlanningPoker/resources/images/carte1.png" /> ',
  listeners: [{
    element: 'element',
    delegate: 'img.logo0',
    event: 'tap',
    fn: function() {
      console.log('One!');
    }
  },
  {
    element: 'element',
    delegate: 'img.logo1',
    event: 'tap',
    fn:function() {
      console.log('Two!');
    }
  }]
}]
4

1 回答 1

1

干得好

Ext.Loader.setConfig({
    enabled : true
});

Ext.application({
    name : ('SF' || 'SenchaFiddle'),

    launch : function() {
        Ext.create('Ext.Panel', {
            fullscreen : true,
            items: [{
                xtype: 'panel',
                html: '<img class="logo0" src="http://25.media.tumblr.com/avatar_71ef465a7108_64.png" /><img class="logo1" src="http://existdissolve.com/wp-content/uploads/2010/08/sencha-logo-64x64.png" /> ',
                listeners: [{
                    element: 'element',
                    delegate: 'img.logo0',
                    event: 'tap',
                    fn: function() {
                        Ext.DomQuery.select('img.logo1')[0].style.display = 'none';
                    }
                }, {
                    element: 'element',
                    delegate: 'img.logo1',
                    event: 'tap',
                    fn:function() {
                        Ext.DomQuery.select('img.logo0')[0].style.display = 'none';
                    }
                }]
            }]
        });
    }
});

希望这可以帮助

于 2013-06-04T13:06:42.113 回答