lwc

Showing a loading indicator while calling Apex in Salesforce LWC

折月煮酒 提交于 2020-05-16 06:28:50
问题 What is the best way to show a loading indicator while retrieving data from Apex in a Lightning Web Component? I have this approach: import { LightningElement, api } from "lwc"; import shouldShowCard from "@salesforce/apex/ApexClass.shouldShowCard"; /** * Card component that is conditionally shown based on Apex. */ export default class ConditionalCard extends LightningElement { @api recordId; @api isDone = false; @api shouldShow = false; connectedCallback() { shouldShowCard({ id: this

SyntaxError: Cannot use import statement outside a module in JEST LWC

99封情书 提交于 2020-01-30 09:16:25
问题 I am trying to test my first lightning web component using visual studio code as my IDE. As instructed I installed Node.js, npm and jest dependency. But I am getting this error Error Image when trying to run the below code driver_Registration.html <template> <div class="slds-m-around_medium"> <p>Hello, {person}!</p> </div> </template> driver_Registration.js import { LightningElement, api } from 'lwc'; export default class Driver_Registration extends LightningElement { @api person = 'World'; }