Vla*_*huk 3 javascript salesforce lwc
我无法完成挑战“亲身体验新警报、确认和提示模块和组件”。我很确定这个挑战有一个错误,我想知道我犯了一个错误,或者这个挑战有错误。
分配:
import { LightningElement, api } from "lwc";
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
onDeleteAllFilesButtonClick() {
const confirmation = confirm("Are you sure you want to delete all files?");
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的解决方案:
import { LightningElement, api } from "lwc";
import LightningConfirm from "lightning/confirm";
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
configs = {
Message: "Are you sure you want to delete all files?",
Label: "Are you sure you want to delete all files?",
Variant: "headerless"
}
onDeleteAllFilesButtonClick() {
const confirmation = LightningConfirm.open(this.configs);
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
Run Code Online (Sandbox Code Playgroud)
发生错误:您的.org 中的挑战尚未完成 LightningConfirm 方法中使用的消息不正确。
小智 5
LWC 的 JS 文件应类似于以下内容:
import { LightningElement, api } from "lwc";
import LightningConfirm from 'lightning/confirm';
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
onDeleteAllFilesButtonClick() {
const confirmation = LightningConfirm.open({
Message: 'Are you sure you want to delete all files?',
Variant: 'headerless',
Label: 'Are you sure you want to delete all files?'
});
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助。谢谢!
| 归档时间: |
|
| 查看次数: |
3086 次 |
| 最近记录: |