-
-
Save TheShubhamVsnv/5bb7f99f94bb06df82dce8c78f532105 to your computer and use it in GitHub Desktop.
spinner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, track } from 'lwc'; | |
export default class MyComponent extends LightningElement { | |
// Boolean variable to track if the spinner should be shown or not | |
@track isLoading = false; | |
// Method triggered when the button is clicked | |
handleButtonClick() { | |
// Set isLoading to true to display the spinner | |
this.isLoading = true; | |
// Simulating a delay before hiding the spinner | |
setTimeout(() => { | |
// Set isLoading back to false to hide the spinner | |
this.isLoading = false; | |
}, 2000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment