Salesforce Lightning 使用lightning:dualListbox报错“Can not read property 'xxx' of undefined”

本文介绍了解决Salesforce Lightning DualListbox组件在Spring '18版本中出现的错误方法。要避免此错误,必须完整填写所有必要属性,包括label, sourceLabel, selectedLabel及options。提供了正确的组件配置示例。

https://salesforce.stackexchange.com/questions/210323/lightningduallistbox-error-in-spring-18?noredirect=1#comment317091_210323

原因是lightning:dualListbox控件需要写全”label”, “sourceLabel”, “selectedLabel”, “options”属性。
参考官网写法:

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_dualListbox.htm

<aura:component>
    <aura:attribute name="listOptions" type="List" default="[]"/>
    <aura:attribute name="defaultOptions" type="List" default="[]"/>
    <aura:attribute name="requiredOptions" type="List" default="[]"/>
    <aura:handler name="init" value="{! this }" action="{! c.initialize }"/>
    <lightning:dualListbox aura:id="selectOptions" name="Select Options"  label= "Select Options" 
                           sourceLabel="Available Options" 
                           selectedLabel="Selected Options" 
                           options="{! v.listOptions }"
                           value="{! v.defaultOptions }"
                           requiredOptions="{! v.requiredOptions }"
                           onchange="{! c.handleChange }"/>
</aura:component>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值