fix: select option value support number 0
parent
c4c75bab0f
commit
2ed0d62fcf
|
@ -45,7 +45,7 @@ export function saveRef (key, c) {
|
||||||
export function getActiveKey (props, originalActiveKey) {
|
export function getActiveKey (props, originalActiveKey) {
|
||||||
let activeKey = originalActiveKey
|
let activeKey = originalActiveKey
|
||||||
const { eventKey, defaultActiveFirst, children } = props
|
const { eventKey, defaultActiveFirst, children } = props
|
||||||
if (activeKey) {
|
if (activeKey !== undefined && activeKey !== null) {
|
||||||
let found
|
let found
|
||||||
loopMenuItem(children, (c, i) => {
|
loopMenuItem(children, (c, i) => {
|
||||||
const propsData = c.componentOptions.propsData || {}
|
const propsData = c.componentOptions.propsData || {}
|
||||||
|
@ -205,7 +205,7 @@ const SubPopupMenu = {
|
||||||
|
|
||||||
getEventKey () {
|
getEventKey () {
|
||||||
// when eventKey not available ,it's menu and return menu id '0-menu-'
|
// when eventKey not available ,it's menu and return menu id '0-menu-'
|
||||||
return this.eventKey || '0-menu-'
|
return this.eventKey !== undefined ? this.eventKey : '0-menu-'
|
||||||
},
|
},
|
||||||
|
|
||||||
getOpenTransitionName () {
|
getOpenTransitionName () {
|
||||||
|
|
|
@ -3,7 +3,7 @@ export function noop () {
|
||||||
|
|
||||||
export function getKeyFromChildrenIndex (child, menuEventKey, index) {
|
export function getKeyFromChildrenIndex (child, menuEventKey, index) {
|
||||||
const prefix = menuEventKey || ''
|
const prefix = menuEventKey || ''
|
||||||
return child.key || `${prefix}item_${index}`
|
return child.key === undefined ? `${prefix}item_${index}` : child.key
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMenuIdFromSubMenuEventKey (eventKey) {
|
export function getMenuIdFromSubMenuEventKey (eventKey) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ export default {
|
||||||
let clonedMenuItems = menuItems
|
let clonedMenuItems = menuItems
|
||||||
if (selectedKeys.length || firstActiveValue) {
|
if (selectedKeys.length || firstActiveValue) {
|
||||||
if (props.visible && !this.lastVisible) {
|
if (props.visible && !this.lastVisible) {
|
||||||
activeKeyProps.activeKey = selectedKeys[0] || firstActiveValue
|
activeKeyProps.activeKey = selectedKeys[0] !== undefined ? selectedKeys[0] : firstActiveValue
|
||||||
}
|
}
|
||||||
let foundFirst = false
|
let foundFirst = false
|
||||||
// set firstActiveItem via cloning menus
|
// set firstActiveItem via cloning menus
|
||||||
|
|
|
@ -122,7 +122,7 @@ export function getSelectKeys (menuItems, value) {
|
||||||
} else {
|
} else {
|
||||||
const itemValue = getValuePropValue(item)
|
const itemValue = getValuePropValue(item)
|
||||||
const itemKey = item.key
|
const itemKey = item.key
|
||||||
if (findIndexInValueBySingleValue(value, itemValue) !== -1 && itemKey) {
|
if (findIndexInValueBySingleValue(value, itemValue) !== -1 && itemKey !== undefined) {
|
||||||
selectedKeys.push(itemKey)
|
selectedKeys.push(itemKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue