TypeError: mod is not a function 错误在reactJs中

Ali*_*eri 3 reactjs next.js swiper.js

我将 Swiper 从版本 9.3.2 升级到 10.2.0,现在我遇到了 TypeError : mod is not a function error in reactJs。

Ali*_*eri 8

经过各种测试,我意识到在新版本中,我们需要将模块寻址从

import { EffectFade } from 'swiper';
Run Code Online (Sandbox Code Playgroud)

import { EffectFade } from 'swiper/modules';
Run Code Online (Sandbox Code Playgroud)

如果仍然有错误,请尝试此方法。

import { Swiper, SwiperSlide } from 'swiper/react';
Run Code Online (Sandbox Code Playgroud)