Created
October 10, 2019 04:01
-
-
Save dhaniksahni/0f4ab616598fab9a9fd49b29508ec920 to your computer and use it in GitHub Desktop.
Custom Data Type for Image in Lightning Web Component
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
.image | |
{ | |
height: 30px; | |
width: 30px; | |
} |
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> | |
<img src={url} alt={altText} class="image"/> | |
</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'; | |
export default class ImageControl extends LightningElement { | |
@api url; | |
@api altText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment