I have 3 lightning tabs. I want to run a particular piece of code on switching between these tabs. Is there a way I can do it. I tried writing the code in renderedCallback and connectedCallback, but none of these methods are called on switching between tabs.
Asked
Active
Viewed 4,787 times
1 Answers
0
You could add onactive in your markup
<lightning-tabset active-tab-value={activeTab}>
<lightning-tab label="Item One" onactive={handleClick} value="one">
One Content !
</lightning-tab>
<lightning-tab label="Item Two" onactive={handleClick} value="two">
Two Content !
</lightning-tab>
<lightning-tab label="Item Three" onactive={handleCLick} value="three">
Three Content !
</lightning-tab>

mSinisa
- 3
- 1
- 4
-
I am looking for something that could be invoked on switching of the standard tabs that salesforce provides where we assign our custom components. So basically the components in the respective tabs will be having an independent hierarchy. – anish samant Jul 23 '20 at 04:20