1 year ago
#336646
Geek
Salesforce LWC - Breadcrumbs
I am trying to create a breadcrumb using lwc component to display it on my community pages. I don't find a way to get the names of the pages dynamically. I need to use the same breadcrumb component in multiple pages, but it should be dynamic.
Here is what I have tried in my lwc template.
<template>
<lightning-breadcrumbs>
<lightning-breadcrumb
label="My Home Page" href="" onclick={redirectHome}>
</lightning-breadcrumb>
<lightning-breadcrumb label="Sub page1" href="" onclick={redirectpage1}>
</lightning-breadcrumb>
<lightning-breadcrumb label="Sub page2" href="" onclick={redirectpage2}>
</lightning-breadcrumb>
</lightning-breadcrumbs></template>
In js, I am trying to set the home page something like this :
redirectHome() {
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'home'
},
});
}
- How to make the redirect function dynamic here?
- How to display the current page name in the template?
Thanks in advance!
salesforce
salesforce-lightning
lwc
0 Answers
Your Answer