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

[Feature Request] DropdownItem请求添加点击事件 #12622

Open
F5F5 opened this issue Feb 5, 2024 · 0 comments
Open

[Feature Request] DropdownItem请求添加点击事件 #12622

F5F5 opened this issue Feb 5, 2024 · 0 comments

Comments

@F5F5
Copy link

F5F5 commented Feb 5, 2024

这个功能解决了什么问题?

有需求切换DropdownItem的时候,需要先判断是否满足切换条件,不满足条件就拦截切换并给出提示,

目前想法是所有DropdownItem都添加disabled属性,然后在点击事件中做判断并调用DropdownItem的toggle方法,

但是查看文档,目前DropdownItem并不支持点击事件,希望可以添加一下,感谢🙏

你期望的 API 是什么样子的?

<van-dropdown-menu>
  <van-dropdown-item @click="onClick" v-model="value1" :options="option1" />
  <van-dropdown-item @click="onClick" v-model="value2" :options="option2" />
</van-dropdown-menu>
const onClick = () => {
  console.log('item Clicked')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant