光环 - Salesforce , "v.remainingBalance"返回未定义



CMP

<aura:属性名称=";剩余余额";type=";小数"/>

<lightning:tile label="Update Amount ">
<div class="slds-grid slds-wrap">
<div class="slds-col slds-size_1-of-3 slds-align-bottom slds-p-around_medium">
<lightning:input label="Enter New Amount" value="{!v.remainingBalance}" type="Decimal" ></lightning:input>
</div>
<div class="slds-col slds-size_1-of-3 slds-align-bottom slds-p-around_medium">  
<lightning:button variant="neutral"
label="Update Amount"
title="Update Amount"
disabled="{!v.disableButton}"
onclick="{!c.updateRemainingBalance}"/>
</div>
</div>
</lightning:tile>

控制器

({
doInit : function(component, event, helper) {
},
updateRemainingBalance: function(component, event, helper) {
console.log("Check1: " + component.get("v.remainingBalance"));
helper.validateAndUpdateRemainingBalance(component, event);
}
})

Helper

({
validateAndUpdateRemainingBalance : function(component, event) {
console.log("Check2: " + component.get("v.remainingBalance"));
}
}) 

`

v.remainingBalance应返回null/value,而不是未定义的

您的'value="{!v.remainingBalance’只适用于显示内容。没有神奇的双向绑定来保存更改。您想将html输入更改传输到ja变量-您需要onchange()或类似的处理程序dunction。

搜索";onchange";以及";设置并读取选择索引";中的章节https://developer.salesforce.com/docs/component-library/bundle/lightning:input/example文件

例如,网上有很多关于这方面的帖子https://salesforce.stackexchange.com/a/309193/799

相关内容

  • 没有找到相关文章

最新更新