【问题标题】:Salesforce lwc lightning/modal dispatchEventSalesforce lwc 闪电/模态调度事件
【发布时间】:2022-11-11 01:40:23
【问题描述】:

文档 - https://developer.salesforce.com/docs/component-library/bundle/lightning-modal/documentation - 模态 - API 56 当我尝试从模式窗口触发事件到父窗口时 - 完全根据文档中的示例 - 我收到错误 -

无法在“EventTarget”上执行“dispatchEvent”:参数 1 不是“事件”类型。

完全按照文档中的示例

this.dispatchEvent(new CustomEvent('select', {
  detail: {
    id: 42
  }
}));

即使在发送事件的那一刻也会发生错误 - 更不用说收到它的那一刻

我正在等待一个事件,但它没有发生

【问题讨论】:

    标签: salesforce lwc custom-events dispatchevent


    【解决方案1】:

    您必须在组织中启用 Lightning Web Security Enabled 才能使其正常工作。

    你可以检查这个https://salesforce.stackexchange.com/questions/387924/lightning-modal-custom-event-not-working-in-winter-23-release

    我自己检查过,效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-07
      • 1970-01-01
      相关资源
      最近更新 更多