selector组件选中高亮存在因包含关系判断错误问题
aofong opened this issue · comments
aofong commented
Version of antd-mobile
5.35.0
Operating system and its version
iOS
Browser and its version
No response
Sandbox to reproduce
No response
What happened?
如图所示我选择1000的时候会高亮100和1000,组件并没有设置多项属性
查看源码发现使用的是遍历选项值是否包含在选中值中
const items = props.options.map(option => {
const active = (value || []).includes(option[valueName])
const disabled = option[disabledName] || props.disabled
const itemCls = classNames(`${classPrefix}-item`, {
[`${classPrefix}-item-active`]: active && !props.multiple,
[`${classPrefix}-item-multiple-active`]: active && props.multiple,
[`${classPrefix}-item-disabled`]: disabled,
})
})
Relevant log output
No response
aofong commented
@Przeblysk
这里有复现的demo remix框架中运行的,选中demo中的1000或者5000都可以复习
Przeblysk commented
@Przeblysk 这里有复现的demo remix框架中运行的,选中demo中的1000或者5000都可以复习
你demo的外层form去掉没有问题:P
aofong commented
@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧
Przeblysk commented
@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧
你用法不对嘛兄弟 form demo
aofong commented
@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧
你用法不对嘛兄弟 form demo