fix: Cascader item key type error #219

pull/225/head
tangjinzhou 2018-10-12 19:22:01 +08:00
parent 0db7b0a4fd
commit 7082d6f805
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import arrayTreeFilter from 'array-tree-filter'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
export default { export default {
name: 'CascaderMenus',
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
value: PropTypes.array.def([]), value: PropTypes.array.def([]),
@ -46,13 +47,14 @@ export default {
const onSelect = (e) => { const onSelect = (e) => {
this.__emit('select', option, menuIndex, e) this.__emit('select', option, menuIndex, e)
} }
const key = option[this.getFieldName('value')]
const expandProps = { const expandProps = {
attrs: { attrs: {
}, },
on: { on: {
click: onSelect, click: onSelect,
}, },
key: option[this.getFieldName('value')], key: Array.isArray(key) ? key.join('__ant__') : key,
} }
let menuItemCls = `${prefixCls}-menu-item` let menuItemCls = `${prefixCls}-menu-item`
const hasChildren = option[this.getFieldName('children')] && const hasChildren = option[this.getFieldName('children')] &&