diff --git a/packages/cascader/index.wxml b/packages/cascader/index.wxml index 5605c175..1794b829 100644 --- a/packages/cascader/index.wxml +++ b/packages/cascader/index.wxml @@ -37,7 +37,7 @@ wx:for="{{ tab.options }}" wx:for-item="option" wx:key="index" - class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}" + class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}" style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}" data-option="{{ option }}" data-tab-index="{{ tabIndex }}" diff --git a/packages/cascader/index.wxs b/packages/cascader/index.wxs index 215c4ad8..b1aab58b 100644 --- a/packages/cascader/index.wxs +++ b/packages/cascader/index.wxs @@ -1,12 +1,12 @@ var utils = require('../wxs/utils.wxs'); var style = require('../wxs/style.wxs'); -function isSelected(tab, textKey, option) { - return tab.selected && tab.selected[textKey] === option[textKey] +function isSelected(tab, valueKey, option) { + return tab.selected && tab.selected[valueKey] === option[valueKey] } -function optionClass(tab, textKey, option) { - return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled }) +function optionClass(tab, valueKey, option) { + return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled }) } function optionStyle(data) {