miniprogram/node_modules/@vant/weapp/dist/collapse-item/animate.js

(完整代码) 1KB

import { getRect } from '../common/utils';
function useAnimation(context, expanded, mounted, height) {
    const animation = wx.createAnimation({
        duration: 0,
        timingFunction: 'ease-in-out',
    });
    if (expanded) {
        if (height === 0) {
            animation.height('auto').top(1).step();
        }
        else {
            animation
                .height(height)
                .top(1)
                .step({
                duration: mounted ? 300 : 1,
            })
                .height('auto')
                .step();
        }
        context.setData({
            animation: animation.export(),
        });
        return;
    }
    animation.height(height).top(0).step({ duration: 1 }).height(0).step({
        duration: 300,
    });
    context.setData({
        animation: animation.export(),
    });
}
export function setContentAnimate(context, expanded, mounted) {
    getRect(context, '.van-collapse-item__content')
        .then((rect) => rect.height)
        .then((height) => {
        useAnimation(context, expanded, mounted, height);
    });
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。