我正在使用不同的[[导航菜单项设置一个新的Salesforce社区,并且我想制作一个带有指向此自定义菜单项之一的链接的LWC。
我正在使用Salesforce提供的JavaScript导航工具
来实现。我使用了页面类型standard__namedPage,如LWC文档中所述,并用我的自定义导航项的名称填充了属性pageName。 this[NavigationMixin.Navigate]({
type: "standard__namedPage",
attributes: {
pageName: "my-custom-nav-item-name"
}
});
结果只是一个“无效页面”,我不知道为什么。
此解决方案对我有用,可以导航到我的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"
}