You need to sign in to do that
Don't have an account?
Jay Mandal
Svg static resource is not rendering when using Lightning Web Component in community
Hi I am using a lighntning component to gather feedback to show the stars I have used a svg static resource which working fine on lightning platform Its giving error I am using same componnent in community , but stars.svg resource is not rendering in community.
import { LightningElement, track, wire} from 'lwc'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { loadStyle, loadScript } from 'lightning/platformResourceLoader'; import Five_Star from '@salesforce/resourceUrl/Five_Star' import saveFeedbackData from '@salesforce/apex/FeedbackController.saveFeedbackData'; import getAppName from '@salesforce/apex/FeedbackController.getAppName'; import isAllowedFeedback from '@salesforce/apex/FeedbackController.isAllowedFeedback'; export default class FeedbackForm extends LightningElement { renderedCallback() { this.URL= location.pathname; this.pageName=this.URL.split('/').pop(); /* eslint-disable no-console */ if(this.fivestarInitialized){ return; } this.fivestarInitialized=true; Promise.all([ loadScript(this, Five_Star + '/rating.js'), loadStyle(this,Five_Star + '/rating.css'), ]) .then(() => { console.log('scripts loaded'); }) .catch(error =>{ this.dispatchEvent( new ShowToastEvent({ title: 'Error loading Five_Star', message: error.message, variant: 'error', }), ); }); } showfeedbackForm(){ console.log('openmodel='+self.openmodel); window.clearTimeout(this.delayTimeout); // eslint-disable-next-line @lwc/lwc/no-async-operation this.delayTimeout = setTimeout(() => { if(this.readonly){ this.domEl=this.template.querySelector('[data-id="ratingareareadOnly"]'); // this.domEl1=this.template.querySelector('[data-id="ratingareareadOnly1"]'); }else{ this.domEl=this.template.querySelector('[data-id="ratingArea"]'); // this.domEl1=this.template.querySelector('[data-id="ratingareareadOnly1"]'); } }
now replace css line refering static resource background using below code: