如何使用LWC导航到社区的菜单项

问题描述 投票:1回答:1

我正在使用不同的[[导航菜单项设置一个新的Salesforce社区,并且我想制作一个带有指向此自定义菜单项之一的链接的LWC

我正在使用Salesforce提供的

JavaScript导航工具

来实现。我使用了页面类型standard__namedPage,如LWC文档中所述,并用我的自定义导航项的名称填充了属性pageName。 this[NavigationMixin.Navigate]({ type: "standard__namedPage", attributes: { pageName: "my-custom-nav-item-name" } });
结果只是一个“无效页面”,我不知道为什么。
salesforce salesforce-lightning
1个回答
0
投票
看来您需要确保社区中的页面引用与正确的页面类型匹配。我认为SF文档有点令人困惑。

此解决方案对我有用,可以导航到我的LWC社区页面中的自定义记录列表页面:

this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'PMP_Offering__c', actionName: 'home' }, state: { filterName: 'Default' } });

此外,这些解决方案也很有效:

//Page Reference -- Community Page type: 'comm__namedPage', attributes: { pageName: this.communityPage }

// Page Reference -- Record Page
                type: "standard__recordPage",
                attributes: {
                    recordId: this.recordId,
                    objectApiName: this.objectPage,
                    actionName: "view"
                }
// Page Reference -- Object Page
                type: "standard__objectPage",
                attributes: {
                    objectApiName: this.objectPage,
                    actionName: "list"
                },
                state: {
                    filterName: "Recent"
                }
© www.soinside.com 2019 - 2024. All rights reserved.