Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selector组件选中高亮存在因包含关系判断错误问题 #6590

Closed
aofong opened this issue Apr 8, 2024 · 6 comments
Closed

selector组件选中高亮存在因包含关系判断错误问题 #6590

aofong opened this issue Apr 8, 2024 · 6 comments
Labels

Comments

@aofong
Copy link

aofong commented Apr 8, 2024

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

查看源码位置

WX20240408-093959@2x

Relevant log output

No response

@aofong aofong added the bug label Apr 8, 2024
@Przeblysk
Copy link
Contributor

Przeblysk commented Apr 8, 2024

CleanShot2024-04-08at11 02 29@2x
没有复现 demo

@aofong
Copy link
Author

aofong commented Apr 8, 2024

@Przeblysk
这里有复现的demo remix框架中运行的,选中demo中的1000或者5000都可以复习

@Przeblysk
Copy link
Contributor

Przeblysk commented Apr 8, 2024

@Przeblysk 这里有复现的demo remix框架中运行的,选中demo中的1000或者5000都可以复习

你demo的外层form去掉没有问题:P

@aofong
Copy link
Author

aofong commented Apr 8, 2024

@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧

@Przeblysk
Copy link
Contributor

@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧

你用法不对嘛兄弟 form demo

@aofong
Copy link
Author

aofong commented Apr 8, 2024

@Przeblysk 我是想要放到 form 表单里面使用的,去掉了 form,就不方便了吧

你用法不对嘛兄弟 form demo

谢谢,是这里的问题
image

@aofong aofong closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants