SwipeJS 无法正常运行
SwipeJS not functioning properly
My Swipe.Js version : "^7.0.2"
所以我今天尝试使用 Swipe.Js。当我导入时,我使用了这个代码行。
import { Swiper, SwiperSlide } from 'swiper/react';
as in https://swiperjs.com/react#installation. But when I implement this I get error like this.
./src/App.jsx
Module not found: Can't resolve 'swiper/react' in 'C:\Users\User.LAPTOP-3EBUUP6S\Desktop\My future projects\new\smart-parking-system\src'
所以我查看了 node_modules 文件夹,然后我发现 Swiper
和 SwiperSlide
函数在哪里。所以我使用这一行导入了那个文件。
import { Swiper, SwiperSlide } from 'swiper/react/swiper-react.js';
但它也给出这样的错误。
./node_modules/swiper/react/get-params.js
Module not found: Can't resolve 'swiper' in 'C:\Users\User.LAPTOP-3EBUUP6S\Desktop\My future projects\new\smart-parking-system\node_modules\swiper\react'
那么如何以正确的方式导入呢?我在文档中看到文件从 Swiper 6 更改为 7。(https://swiperjs.com/react#installation)但是显示(如
link 的样式导入)不起作用。所以我不得不查看 node_modules 然后进行导入。但是顺便说一句,导入 Swiper 和 SwiperSlide 是行不通的。这是为什么?
将您的版本降级到 6.8.4!它就像魔法一样有效!
My Swipe.Js version : "^7.0.2"
所以我今天尝试使用 Swipe.Js。当我导入时,我使用了这个代码行。
import { Swiper, SwiperSlide } from 'swiper/react';
as in https://swiperjs.com/react#installation. But when I implement this I get error like this.
./src/App.jsx
Module not found: Can't resolve 'swiper/react' in 'C:\Users\User.LAPTOP-3EBUUP6S\Desktop\My future projects\new\smart-parking-system\src'
所以我查看了 node_modules 文件夹,然后我发现 Swiper
和 SwiperSlide
函数在哪里。所以我使用这一行导入了那个文件。
import { Swiper, SwiperSlide } from 'swiper/react/swiper-react.js';
但它也给出这样的错误。
./node_modules/swiper/react/get-params.js
Module not found: Can't resolve 'swiper' in 'C:\Users\User.LAPTOP-3EBUUP6S\Desktop\My future projects\new\smart-parking-system\node_modules\swiper\react'
那么如何以正确的方式导入呢?我在文档中看到文件从 Swiper 6 更改为 7。(https://swiperjs.com/react#installation)但是显示(如 link 的样式导入)不起作用。所以我不得不查看 node_modules 然后进行导入。但是顺便说一句,导入 Swiper 和 SwiperSlide 是行不通的。这是为什么?
将您的版本降级到 6.8.4!它就像魔法一样有效!