feat(dropdown): allow pass string for prop trigger #4199
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a ...
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)
而不是
What's the effect? (Optional if not new feature)
允许trigger属性直接指定字符串而不是字符串数组
Changelog description (Optional if not new feature)
feat(dropdown): allow pass string for prop trigger
feat(dropdown): 允许trigger属性直接指定字符串
Self Check before Merge