odc.xiaohui
2023-03-21 e604a4e954b3e0252c86f11bf3c1bb78f9b65951
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 optionClass(tab, textKey, option) {
  return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
}
 
function optionStyle(data) {
  var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
  return style({
    color
  });
}
 
 
module.exports = {
  isSelected: isSelected,
  optionClass: optionClass,
  optionStyle: optionStyle,
};