Skip to content

feat(dropdown): allow pass string for prop trigger #4199

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

Merged
merged 1 commit into from
Jun 11, 2021

Conversation

CarterLi
Copy link
Contributor

@CarterLi CarterLi commented Jun 11, 2021

This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

What's the background?

点击展开下拉框是非常常见的需求(个人感觉比hover展开还常见),但是现在dropdown组件强制要求传入数组而不能直接传入一个字符串。

我试过了dropdown组件实际上传入字符串是可以正常工作的,但不知为何在prop声明的时候没有允许传入字符串

https://github.com/vueComponent/ant-design-vue/blob/next/components/vc-trigger/Trigger.jsx#L46

另外传入字符串比传入数组性能更好。因为数组是对象,每次vdom diff时数组的引用都是不同的,可能导致watch等频繁触发,除非把数组定义在data里面,而在模板里使用变量。

API Realization (Optional if not new feature)

<a-dropdown trigger="click" />

而不是

<a-dropdown :trigger="['click']" />

What's the effect? (Optional if not new feature)

允许trigger属性直接指定字符串而不是字符串数组

Changelog description (Optional if not new feature)

  1. English description

feat(dropdown): allow pass string for prop trigger

  1. Chinese description (optional)

feat(dropdown): 允许trigger属性直接指定字符串

Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@tangjinzhou tangjinzhou merged commit ce6f44f into vueComponent:next Jun 11, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants