diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx index 722aae18c..be6377ee6 100644 --- a/components/collapse/Collapse.tsx +++ b/components/collapse/Collapse.tsx @@ -42,7 +42,6 @@ export default defineComponent({ accordion: false, destroyInactivePanel: false, bordered: true, - openAnimation: collapseMotion('ant-motion-collapse', false), expandIconPosition: 'start', }), slots: Object as CustomSlotsType<{ @@ -61,7 +60,7 @@ export default defineComponent({ }, { deep: true }, ); - const { prefixCls, direction } = useConfigInject('collapse', props); + const { prefixCls, direction, rootPrefixCls } = useConfigInject('collapse', props); // style const [wrapSSR, hashId] = useStyle(prefixCls); @@ -131,6 +130,7 @@ export default defineComponent({ if (isEmptyElement(child)) return; const activeKey = stateActiveKey.value; const { accordion, destroyInactivePanel, collapsible, openAnimation } = props; + const animation = openAnimation || collapseMotion(`${rootPrefixCls.value}-motion-collapse`); // If there is no key provide, use the panel order as default key const key = String(child.key ?? index); @@ -161,7 +161,7 @@ export default defineComponent({ isActive, prefixCls: prefixCls.value, destroyInactivePanel, - openAnimation, + openAnimation: animation, accordion, onItemClick: mergeCollapsible === 'disabled' ? null : onClickItem, expandIcon: renderExpandIcon,