朱桂飞
2023-04-03 458962a2e4a4f6af0caa5fcb3867f2e42125fd40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export default function transitionEmit({
    swiper,
    runCallbacks,
    direction,
    step
}) {
    const {
        activeIndex,
        previousIndex
    } = swiper;
    let dir = direction;
 
    if (!dir) {
        if (activeIndex > previousIndex) dir = 'next';
        else if (activeIndex < previousIndex) dir = 'prev';
        else dir = 'reset';
    }
 
    swiper.emit(`transition${step}`);
 
    if (runCallbacks && activeIndex !== previousIndex) {
        if (dir === 'reset') {
            swiper.emit(`slideResetTransition${step}`);
            return;
        }
 
        swiper.emit(`slideChangeTransition${step}`);
 
        if (dir === 'next') {
            swiper.emit(`slideNextTransition${step}`);
        } else {
            swiper.emit(`slidePrevTransition${step}`);
        }
    }
}