728x90
반응형
1.
import { LightningElement } from 'lwc';
import LightningAlert from "lightning/alert";
import LightningPrompt from "lightning/prompt";
import LightningConfirm from "lightning/confirm";
export default class NotificationLWC extends LightningElement {
async handleAlert(){
await LightningAlert.open({
message : "Sample Alert Message",
theme : "error",
label: "Alert Header"
}) .then(()=>{
console.log('###Alert Closed');
})
}
async handleConfirm(){
const result = await LightningConfirm.open({
message : "Sample Confirm Message",
theme : "Success",
label: "Confirm Header"
})
console.log('###Result : ' + result);
}
async handlePrompt(){
await LightningPrompt.open({
message : "Sample Prompt Message",
theme : "error",
label: "Prompt Header",
defaultValue:'Test'
}) .then((result)=>{
console.log('###Result : ' + result);
})
}
}
- notification(alert,confirm,prompt)는 import해야한다.
- async로 function 관리하며, await ~~.open으로 message,theme,label,defaultValue등 관리한다.
728x90
반응형
'Salesforce' 카테고리의 다른 글
Salesforce LWC Life-Cycle(생명주기) (0) | 2024.04.02 |
---|---|
Salesforce LWC <lightning-record-form> 태그 (0) | 2024.01.23 |
Salesforce LWC iterator(반복자) , for:each (2) | 2023.12.04 |
Salesforce ApexClass @AuraEnabled(cacheable=true) , @wire (0) | 2023.11.30 |
Salesforce LWC Use Components in Salesforce Targets (meta.xml , Flow , ScreenAction ,headerlessAction) (0) | 2023.11.30 |