Created
September 23, 2019 14:13
-
-
Save britishboyindc/49c122832cf487d3ff04108941d01c69 to your computer and use it in GitHub Desktop.
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> | |
<template if:true={opportunity}> | |
{myAmount} | |
</template> | |
</template> | |
import { LightningElement,api, wire } from 'lwc'; | |
import { getRecord } from 'lightning/uiRecordApi'; | |
const FIELDS = ['Opportunity.Name', 'Opportunity.Amount']; | |
export default class DemoOptyAmount extends LightningElement { | |
@api recordId; | |
@wire(getRecord, { recordId: '$recordId', fields: FIELDS }) | |
opportunity; | |
get myAmount() { | |
if (this.opportunity && this.opportunity.data) { | |
return this.opportunity.data.fields.Amount.value; | |
} | |
return 0; | |
} | |
} | |
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
<!-- Demo Opty Parent --> | |
<template> | |
<lightning-input label="parent id" onchange={handleIdChange}></lightning-input> | |
<c-demo-opty-amount record-id={parentid}></c-demo-opty-amount> | |
</template> | |
import { LightningElement, track } from 'lwc'; | |
export default class DemoOptyParent extends LightningElement { | |
@track parentid =''; | |
handleIdChange (event) { | |
try { | |
let evtvar = event.target.value; | |
console.log(evtvar); | |
this.parentid = evtvar; | |
} | |
catch (err){ | |
console.log(err); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment