diff --git a/packages/collapse-item/animate.ts b/packages/collapse-item/animate.ts index 9f858156..e9b98ca7 100644 --- a/packages/collapse-item/animate.ts +++ b/packages/collapse-item/animate.ts @@ -1,43 +1,5 @@ -import { canIUseAnimate } from '../common/version'; import { getRect } from '../common/utils'; -function useAnimate( - context: WechatMiniprogram.Component.TrivialInstance, - expanded: boolean, - mounted: boolean, - height: number -) { - const selector = '.van-collapse-item__wrapper'; - if (expanded) { - context.animate( - selector, - [ - { height: 0, ease: 'ease-in-out', offset: 0 }, - { height: `${height}px`, ease: 'ease-in-out', offset: 1 }, - { height: `auto`, ease: 'ease-in-out', offset: 1 }, - ], - mounted ? 300 : 0, - () => { - context.clearAnimation(selector); - } - ); - - return; - } - - context.animate( - selector, - [ - { height: `${height}px`, ease: 'ease-in-out', offset: 0 }, - { height: 0, ease: 'ease-in-out', offset: 1 }, - ], - 300, - () => { - context.clearAnimation(selector); - } - ); -} - function useAnimation( context: WechatMiniprogram.Component.TrivialInstance, expanded: boolean, @@ -86,8 +48,6 @@ export function setContentAnimate( getRect(context, '.van-collapse-item__content') .then((rect) => rect.height) .then((height: number) => { - canIUseAnimate() - ? useAnimate(context, expanded, mounted, height) - : useAnimation(context, expanded, mounted, height); + useAnimation(context, expanded, mounted, height); }); }