文件constant.js
import { LightningElement } from 'lwc';
import { createRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import CONTACT_OBJECT from '@salesforce/schema/Contact';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import PHONE_FIELD from '@salesforce/schema/Contact.Phone';
import FAX_FIELD from '@salesforce/schema/Contact.Fax';
文件contact.js
export default class LdsCreateRecord extends LightningElement {
}
如何在contact.js中包含constant.js文件
如果您的意思是“如何将contact.js文件包含在constant.js中,那么这很简单:
import { LdsCreateRecord } from './contact.js';
如果您说的是:“如何在contact.js中包含constant.js文件,那么您必须先从constant.js中导出某些内容。