Last active
October 11, 2020 05:23
-
-
Save salesforce-casts/d984f2bf7f72614b69950fcf317a0cee to your computer and use it in GitHub Desktop.
Basic event handling. Not going to bubble though there are event listeners wrapping the button. {bubbles: false, composed : false} [Default config]
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
<template> | |
<c-child></c-child> | |
</template> |
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 App extends LightningElement { | |
} |
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
<template> | |
<section onteja={handleTeja}> | |
<div onteja={handleTeja}> | |
<span onteja={handleTeja}> | |
<lightning-button label="Send" onclick={handleSend}> | |
</lightning-button> | |
</span> | |
</div> | |
</section> | |
</template> |
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, api } from 'lwc'; | |
/** | |
* Show an item | |
*/ | |
export default class Child extends LightningElement { | |
handleSend(){ | |
this.template.querySelector('span') | |
.dispatchEvent(new CustomEvent('teja')) | |
} | |
handleTeja(){ | |
console.log('AM IN TEJA!!!!!'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment