如何在煎茶触摸 2 中单击面板时显示叠加层

How to show a overlay when Panel is clicked in Sencha Touch 2

本文关键字:显示 叠加 单击 触摸      更新时间:2023-09-26

我在Sencha Touch 2中有一个ActionSheet和一个面板。我想在面板中单击图标地图时显示操作表叠加层,我该怎么做?

面板.js

Ext.define('app.view.principalTabPanel', {
    extend: 'Ext.tab.Panel',
    config: {
        ui: 'light',
        items: [
            {
                xtype: 'mappanel',
                title: 'Map',
                iconCls: 'locate'
            }
        ],
        tabBar: {
            docked: 'bottom',
            ui: 'light'
        }
    }
});

问.js

Ext.define('app.view.takePhoto', {
    extend: 'Ext.ActionSheet',
    config: {
        items: [
        {
            text: 'Delete draft',
            ui  : 'decline'
        },
        {
            text: 'Save draft'
        },
        {
            text: 'Cancel',
            ui  : 'confirm'
        }
        ]
    }
});
您可以通过

在项目的tab对象内的选项卡中添加一个侦听器来执行此操作。

{
    xtype: 'mappanel',
    title: 'Map',
    iconCls: 'locate'
    tab: {
        listeners: {
            tap: function() {
                var sheet = Ext.create('app.view.takePhoto');
                sheet.show();
            }
        }
    }
}

在该侦听器中,我们创建 app.view.takePhoto 类的新实例并显示它。

在将 show() 更改为 showBy() 后,我遇到了同样的问题。指定 html id 而不是组件就可以解决问题

.showBy(Ext.get('ext-tab-5'));

而不是

.showBy('settingsTab')

似乎该方法只能在 DOM 元素上调用。

希望这有所帮助。