【发布时间】:2020-10-07 11:15:50
【问题描述】:
我正在尝试将数据从 Aura 发布到 LWC。我收到错误以纠正我所缺少的。 我检查了多个示例作为语法明智,仍然没有工作。因此发帖看看有没有人可以帮忙。
Aura 组件 html:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<a href="javascript:void(0);" onclick="{!c.publishMC}">More Information</a>
<lightning:messageChannel type="AlertMessageChannel__c" aura:id="AlertMessageChannel"></lightning:messageChannel>
</aura:component>
光环控制器 JS:
({
publishMC : function(component, event, helper) {
var messageInfo = [
{ normalTxt: '', boldTxt: '', boldLeftTxt: 'This opportunity is Stale',
normalRightTxt: 'the stale reason code is EOD PAST DUE.'},
{ normalTxt: '', boldTxt: '', boldLeftTxt: 'This account has 1 or more Frame
Agreements', normalRightTxt: 'There is a Frame Agreement associated to the account,
if applicable, please link to this opportunity using the Contract ID field.'},
];
component.find("AlertMessageChannel").publish(messageInfo);
}
})
我也添加了消息服务 xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
<description>This is a alert message channel communicator</description>
<isExposed>true</isExposed>
<lightningMessageFields>
<description>Header information passed into alert modal window</description>
<fieldName>alertHeaderInfo</fieldName>
</lightningMessageFields>
<lightningMessageFields>
<description>Body information passed into alert modal window</description>
<fieldName>alertBodyInfo</fieldName>
</lightningMessageFields>
<lightningMessageFields>
<description>Show/Hide information passed into alert modal window</description>
<fieldName>alertVisibleInfo</fieldName>
</lightningMessageFields>
<masterLabel>AlertMessageChannel</masterLabel>
但是当尝试加载时,出现错误:
操作失败:闪电:messageChannel$controller$init [闪电消息服务 - 无法识别的消息通道参考:AlertMessageChannel__c]
谁能帮帮我,我错过了什么?
【问题讨论】: