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

🐛 [Bug]: [DropdownMenu] 默认值 defaultValue #731

Open
1 of 2 tasks
f3liiix opened this issue Jun 13, 2024 · 0 comments
Open
1 of 2 tasks

🐛 [Bug]: [DropdownMenu] 默认值 defaultValue #731

f3liiix opened this issue Jun 13, 2024 · 0 comments

Comments

@f3liiix
Copy link

f3liiix commented Jun 13, 2024

Which React Vant packages are impacted?

  • react-vant (React Vant core)
  • react-vant-icons(React Vant Icon)

What version of React Vant are you using?

3.3.5

Reproduce live demo(codesandebox or stackblitz)?

No response

Descripition

默认值 defaultValue 依然有问题

const areas = [ { text: '武汉', value: 1 }, { text: '长沙', value: 2 }, { text: '成都', value: 3 }, ]

const [value, setValue] = useState<Record<string, string | number>>({})

<DropdownMenu className='areas' value={value} defaultValue={{text: '武汉', value: 1}} onChange={v => setValue(v)}> <DropdownMenu.Item name='value1' options={areas}/> </DropdownMenu>

设置了默认值,但是依然显示 “请选择”

screenshot-20240613-183038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant