当前位置:网站首页>Salesforce fileUpload (III) how to display uploaded images

Salesforce fileUpload (III) how to display uploaded images

2022-06-23 02:13:00 repick

fileUpLoadImageDisplayLWC.html

<template>
    <lightning-card title="LWC File Upload Example Dipplay" icon-name="custom:custom19">
        <lightning-input onchange={inputChange}></lightning-input>
        <template if:true={imageUrl}>
            <img src={imageUrl}/>
        </template>
    </lightning-card>
</template>

fileUpLoadImageDisplayLWC.js

import { LightningElement,track } from 'lwc';

export default class FileUpLoadImageDisplayLWC extends LightningElement {
  @track imageUrl;
    inputChange(e) {
        if (e.target.value)
            this.imageUrl = '/sfc/servlet.shepherd/version/download/'  + e.target.value
    }
}

fileUpLoadImageDisplayLWC.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

Put the developed Lwc Configuration to Account detailed Page

Input 【ContentVersion】 The corresponding picture in the table Id

原网站

版权声明
本文为[repick]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202091754070115.html