0

我需要在非控制台应用程序环境中的 Lightning Experience 的导航栏中打开新的导航选项卡。选项卡应将记录名称预先填充为标签。

尝试以下方法:为目标闪电组件创建自定义选项卡

在源组件中:

创建了类型为standard__navItemPage 的页面引用。为目标组件指定自定义选项卡名称的属性。使用导航服务将控件重定向到新 URL。

在目标组件中:使用接口 isUrlAddressable 来检索页面参数。

var pageReference = {
                    type: 'standard__navItemPage',
                    attributes: {
                        apiName: 'Product_Overview',
                    },
                    state: {
                        c__productId: itemId,
                        c__isfavourite : isfavourite,
                        c__isSourceSearchResultCmp : false                            
                    }
                };   
         var navService = component.find("navService");
         navService.generateUrl(pageReference)
         .then($A.getCallback(function(url) {
             console.log('Using Navigate'+url);
             navService.navigate(pageReference);
         }), $A.getCallback(function(error) {
             console.log(error);
         }));

问题是,正在打开的导航选项卡没有记录名称等详细信息,我找不到任何相同的 API 或方法。

这里的任何指导将不胜感激。

4

1 回答 1

0
var pageReference = {
    type: 'standard__navItemPage',
    attributes: { 
        apiName: 'Product_Overview', 
    },
    state: { 
        c__productId: itemId,
        c__isfavourite : isfavourite,
        c__isSourceSearchResultCmp : false
    }};
    var navService = component.find("navService");
    navService.generateUrl(pageReference).then($A.getCallback(function(url) { 
        console.log('Using Navigate'+url); 
        //---add this line which allows you to open url in new tab instead of navService 
        window.open('https:'+url,
                    '_blank' // <- This is what makes it open in a new window.
                   );
    }),$A.getCallback(function(error) {
    console.log(error); 
}));
于 2019-07-12T10:50:55.600 回答