You need to sign in to do that
Don't have an account?
Brendan O'Grady 3
Getting an error of: "Cannot read property 'record' of undefined Type Error [1,1]
I'm trying to create my first custom LWC for my own org. I want to just put a smiley face image in the middle of the component with some text at the top. Here is the code below:
js:
import { LightningElement } from 'lwc';
export default class SmileyFinal extends LightningElement
{
pictureUrl = 'https://en.wikipedia.org/wiki/Smiley#/media/File:SNice.svg';
}
html:
<template>
<body>
<div class="slds-m-around_medium">
<h1 class="slds-text-heading_small">Welcome to Brendan's Smiley Class</h1>
<p>The first of many projects.</p>
</div>
<div class="slds-container_center">
<img src={pictureUrl}>
</div>
</body>
</template>
css:
body{
font-family: Helvetica;
color: black;
text-align: center;
justify-content: center;
margin: 0;
}
js:
import { LightningElement } from 'lwc';
export default class SmileyFinal extends LightningElement
{
pictureUrl = 'https://en.wikipedia.org/wiki/Smiley#/media/File:SNice.svg';
}
html:
<template>
<body>
<div class="slds-m-around_medium">
<h1 class="slds-text-heading_small">Welcome to Brendan's Smiley Class</h1>
<p>The first of many projects.</p>
</div>
<div class="slds-container_center">
<img src={pictureUrl}>
</div>
</body>
</template>
css:
body{
font-family: Helvetica;
color: black;
text-align: center;
justify-content: center;
margin: 0;
}
Can you modify your js code as below:
Let me know if this solves your problem.
Thanks,
Abhishek Bansal.