import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexAccessory_Add extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ this.IsLoading = false; if (this.recordId.length == 0) { this.ShowToastEvent("请选择一个借出备品配套一览明细信息", "warning"); } else { window.open("/apex/AccessoryAdd?recid=" + this.recordId, "_top"); } } //弹框 ShowToastEvent(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } }