import { CurrentPageReference } from ‘lightning/navigation’;
export default class Sample extends LightningElement {
@wire(CurrentPageReference)
currentPageReference;
connectedCallback() {
console.log( ‘Param ‘ + this.currentPageReference.state.recId );
}
}
recId is {recId}
</template>
import { CurrentPageReference } from ‘lightning/navigation’;
export default class Sample extends LightningElement {
recId;
@wire(CurrentPageReference)
currentPageReference;
connectedCallback() {
if ( this.currentPageReference.state.c__recId ) {
console.log( ‘recId Param value is ‘ + this.currentPageReference.state.c__recId );
this.recId = this.currentPageReference.state.c__recId;
}
if ( this.currentPageReference.state.c__testParam ) {
console.log( ‘Param ‘ + this.currentPageReference.state.c__testParam );
}
}
}
<LightningComponentBundle xmlns=”http://soap.sforce.com/2006/04/metadata”>
<apiVersion>49.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
<target>lightning__Tab</target>
</targets>
</LightningComponentBundle>