【问题标题】:how to open new tab and redirect to link EXT JS portlet button如何打开新选项卡并重定向到链接 EXT JS portlet 按钮
【发布时间】:2020-12-07 05:27:20
【问题描述】:

如果我单击 portlet 按钮,它必须打开新选项卡并指向我调用的网站。 不幸的是,我无法做到这一点。我试过看煎茶讨论和东西,但我什么也没看到。当我单击按钮 portlet 时,下面是我的代码没有任何反应..

var btnProductsAndServices = {
    xtype: 'portletbutton',
    icon: '/test.png',
    tooltip: 'Products & Services',
    text: 'Products & Services',
    click : window.open("https://www.w3schools.com")
};

我也尝试过这样做,但没有成功。

var btnProductsAndServices = {
    xtype: 'portletbutton',
    icon: '/test.png',
    tooltip: 'Products & Services',
    text: 'Products & Services',
    click : {
        handler: function redirect(){
            window.open("https://www.w3schools.com")
        }
    }
};

【问题讨论】:

    标签: javascript extjs sencha-touch sencha-architect


    【解决方案1】:

    我不知道portletbutton 是什么,但你可以像下面这样使用button:

    Ext.create({
                xtype: 'button',
                tooltip: 'Products & Services',
                text: 'Products & Services',
                renderTo: 'divButton',
                handler: function () {
                    window.open("https://www.w3schools.com");
                }
            });
    

    https://fiddle.sencha.com/#fiddle/3aka

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-30
      相关资源
      最近更新 更多