-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
select options 若存在 {value: 0, lable;'0'} 这项 即options 有一项 value等于数字0 会呈现失败 #1727
Comments
查看源码发现 但是代码中忽略 对非false值即 若有选中项 则默认选中选项为激活项DropdownMenu.jsx#L136 中以下代码导致 selectedKeys[0] || firstActiveValue; if (selectedKeys.length || firstActiveValue) {
if (props.visible && !this.lastVisible) {
--> activeKeyProps.activeKey = selectedKeys[0] || firstActiveValue;
} else if (!visible) {
// Do not trigger auto active since we already have selectedKeys
if (selectedKeys[0]) {
defaultActiveFirst = false;
}
activeKeyProps.activeKey = undefined;
}
} 选中值为 若无选中项 则寻找第一个项为激活项SubPopupMenu.jsx#L67 中以下代码导致 if (defaultActiveFirst) {
loopMenuItem(children, (c, i) => {
const propsData = c.componentOptions.propsData || {};
--> if (!activeKey && c && !propsData.disabled) {
activeKey = getKeyFromChildrenIndex(c, eventKey, i);
}
});
return activeKey;
} 找到第一个为 |
方便的话可以提交个pr and 建议先不要使用数字 0 隐藏风险挺高的 |
你好!我现在就遇到这么一个需求! |
v-bind:defaultActiveFirstOption="false" 不去调用这部分逻辑就行 |
…urn the next child key vueComponent#1727
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
1.4.10
Environment
win10 chrome78 vue2.6.10
Reproduction link
Steps to reproduce
点击下拉框 会发现 紧跟着的第二项也被高亮了

What is expected?
第二项正确显示
What is actually happening?
第二项错误被高亮了
The text was updated successfully, but these errors were encountered: