filesbox/miniprogram/FilesBox/node_modules/@vant/weapp/lib/cascader/index.wxs
2023-09-21 10:23:31 +08:00

24 lines
649 B
XML

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,
};