我是salesforce的新手。父组件中的布尔值将通过裁剪按钮来更新。这就完成了。现在,我想根据父级布尔值在子组件中切换一个类。所以我的问题是,我怎样才能总是从子对象中读取父布尔值呢?
父组件
<aura:attribute name="isActive" type="Boolean" default="false"/>子组件
<div class="{!v.siActive ? 'bg-red' : ''}">
........
</div>发布于 2021-05-23 15:49:38
你看到https://developer.salesforce.com/docs/component-library/bundle/aura:valueChange/documentation了吗?
将父级属性传递给子级(在父级中具有类似于<c:myChild isActive="{!v.isActive}">的内容,然后在子级中定义一个将在值更改时运行的处理程序函数。
实际上patterns for parent-child communication很少,选择看起来最简单的/最接近你已经拥有的
https://stackoverflow.com/questions/67655704
复制相似问题