当前位置: 代码迷 >> 综合 >> Salesforce Lightning 使用lightning:dualListbox报错“Can not read property 'xxx' of undefined”
  详细解决方案

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

热度:18   发布时间:2023-12-19 01:58:44.0

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>
  相关解决方案