I have this formula field that shows the generated qr code on the record detail page:
IMAGE('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://www.yahoo.com' ,'QR code to open yahoo')
I need to display this qr code in an lwc. Adding it as a text field shows the code above. Using IMG and setting the value as src doesn't work either.
js
@wire(getEval, { recordId : '$recordId' })
eDetails({ data, error }){
if(data){
this.nameOnCard = data.Name_on_Card__c;
this.qrCode = data.QR_Code__c;
}else if(error){
console.log('ERROR ----- ', JSON.stringify(error));
}
}
HTML:
<div class="slds-grid" >
<div class="slds-col slds-truncate">
<img src={qrCode}>
</div>
</div>
****Update From the console, I can see the value of qrCode is:
<img src="https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://www.yahoo.com" alt="SQR code to open yahoo" border="0"/>
so it looks like it's ready to just work. . . no need to add to img tag as src. Problem is, it just displays the value above when I need it to render the HTML contained in qrCode.
Any ideas on how to display the actual qr code (like on the record detail page) in an LWC?
<img src={qrCodeUrl}>
? You have to wire the qrCodeUrl with the value from the formula field.