From 7160828cf1a4390ebd6c49f1fdf19d91fef5c988 Mon Sep 17 00:00:00 2001 From: maoweifan Date: Sun, 8 Jan 2023 13:52:11 +0800 Subject: [PATCH] fix(Cascader): cascader__option--select not bind --- packages/cascader/index.wxml | 2 +- packages/cascader/index.wxs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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) {