Last active
August 4, 2020 20:29
-
-
Save justin-lyon/0cabd73aab12f6b5241e3b35a2927af2 to your computer and use it in GitHub Desktop.
LC4VF with LWC Example
This file contains hidden or 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
<apex:page> | |
<apex:includeLightning /> | |
<div id="mount"></div> | |
<script type="text/javascript"> | |
const myLwcProps = { | |
prop1: 1, | |
isSuperAwesomeBool: true | |
} | |
const afterMountCallback = cmp => { | |
// do Stuff after mount - attach event handler etc | |
} | |
$Lightning.use("c:MyAuraApp", () => { | |
$Lightning.createComponent("c:MyLwc", | |
myLwcProps, | |
"mount", // id of the element in the page to mount your component in | |
afterMountCallback | |
}) | |
</script> | |
</apex:page> |
This file contains hidden or 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
<aura:application access="global" extends="ltng:outApp"> | |
<aura:dependency resource="c:MyLwc" /> | |
</aura:application> |
This file contains hidden or 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' | |
export default class MyLwc extends LightningElement { | |
@api prop1 | |
@api isSuperAwesomeBool | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment