1

当我尝试将标记 UI 标记与光照 aura:attribute 绑定为类型 sObject(字段)时,我遇到了一个奇怪的场景。我正在尝试将数据绑定到不同闪电的 sobject 字段:输入标签,对于一个 sObject 属性,绑定工作完美,但对于另一个 sObject,数据没有被绑定。例如:

<aura:attribute name="student" type="JN_Student__c" access="global" default="{'sobjectType' : 'JN_Student__c'}" />
<lightning:input aura:id="requiredVal" name="lastName" label="Legal Last Name"value="{!v.student.JN_Last_Name__c}" maxlength="20" required="true"/>

这非常有效,并且在我显示/隐藏此部分时数据仍然存在。鉴于,

<aura:attribute name="insuranceInstance" type="JN_Insurance__c" access="global" default="{'sobjectType' : 'JN_Insurance__c'}" />
<lightning:input aura:id="requiredVal" name="lastName" label="Legal Last Name" value="{!v.insuranceInstance.Name}" maxlength="20" required="true"/>

'v.insuranceInstance.Name' 不会保持其价值。

如果有人知道/遇到相同的情况,请回复。

4

0 回答 0