fix(Cascader): change isSelected key

This commit is contained in:
maoweifan 2023-01-08 01:59:50 +08:00
parent 9771499383
commit e46d11f837
2 changed files with 3 additions and 3 deletions

View File

@ -38,13 +38,13 @@
wx:for-item="option"
wx:key="index"
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
data-option="{{ option }}"
data-tab-index="{{ tabIndex }}"
bind:tap="onSelect"
>
<text>{{ option[textKey] }}</text>
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
</view>
</view>
<!-- 暂不支持 -->

View File

@ -10,7 +10,7 @@ function optionClass(tab, textKey, option) {
}
function optionStyle(data) {
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
return style({
color
});