File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
components/vc-collapse/src Expand file tree Collapse file tree 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';
1111import { collapseProps } from './commonProps' ;
1212import { getDataAndAriaProps } from '../../_util/util' ;
1313import { defineComponent } from 'vue' ;
14+ import isNil from 'lodash/isNil' ;
1415
1516function _toArray ( activeKey ) {
1617 let currentActiveKey = activeKey ;
1718 if ( ! Array . isArray ( currentActiveKey ) ) {
18- currentActiveKey = currentActiveKey ? [ currentActiveKey ] : [ ] ;
19+ const activeKeyType = typeof currentActiveKey ;
20+ currentActiveKey =
21+ activeKeyType === 'number' || activeKeyType === 'string' ? [ currentActiveKey ] : [ ] ;
1922 }
2023 return currentActiveKey . map ( key => String ( key ) ) ;
2124}
@@ -76,7 +79,7 @@ export default defineComponent({
7679 const { prefixCls, accordion, destroyInactivePanel, expandIcon } = this . $props ;
7780
7881 // 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 ) ;
8083 const { header, headerClass, disabled } = getPropsData ( child ) ;
8184 let isActive = false ;
8285
You can’t perform that action at this time.
0 commit comments