File tree 1 file changed +5
-2
lines changed
components/vc-collapse/src
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,14 @@ import openAnimationFactory from './openAnimationFactory';
11
11
import { collapseProps } from './commonProps' ;
12
12
import { getDataAndAriaProps } from '../../_util/util' ;
13
13
import { defineComponent } from 'vue' ;
14
+ import isNil from 'lodash/isNil' ;
14
15
15
16
function _toArray ( activeKey ) {
16
17
let currentActiveKey = activeKey ;
17
18
if ( ! Array . isArray ( currentActiveKey ) ) {
18
- currentActiveKey = currentActiveKey ? [ currentActiveKey ] : [ ] ;
19
+ const activeKeyType = typeof currentActiveKey ;
20
+ currentActiveKey =
21
+ activeKeyType === 'number' || activeKeyType === 'string' ? [ currentActiveKey ] : [ ] ;
19
22
}
20
23
return currentActiveKey . map ( key => String ( key ) ) ;
21
24
}
@@ -76,7 +79,7 @@ export default defineComponent({
76
79
const { prefixCls, accordion, destroyInactivePanel, expandIcon } = this . $props ;
77
80
78
81
// If there is no key provide, use the panel order as default key
79
- const key = child . key || String ( index ) ;
82
+ const key = ! isNil ( child . key ) ? String ( child . key ) : String ( index ) ;
80
83
const { header, headerClass, disabled } = getPropsData ( child ) ;
81
84
let isActive = false ;
82
85
You can’t perform that action at this time.
0 commit comments