问题描述
我需要从Aura组件发送消息以响应应用程序。本教程正是我想要的:
但是,我需要在加载应用程序后立即发送消息。我们是否具有光环组件的生命周期功能,还是应该调用该功能?例如,在react中,我们有componentDidMount
解决方法
Aura有一个init
事件,在渲染前初始化应用或组件时会触发该事件。
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
官方文档中的更多信息:https://developer.salesforce.com/docs/component-library/bundle/aura:valueInit/documentation