小编Ham*_*aif的帖子

swiper -- slipsPerView={'auto'} 对我不起作用

我正在研究 swiper。我的目的是在滑块中收集一些,但我不想使用breakPonit属性来进行响应式工作。我想要 SlidesPerView,自动填充 swiper 包装器。我阅读了文档并使用了演示...结果就像视图上只出现一个,而 width 和 spaceBetween 是最小的,并且在宽屏中不会改变。

这是我的代码,但它不是我想要的:

import React from 'react';
import { Swiper, SwiperSlide } from "swiper/react";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/scrollbar";
import "swiper/css/free-mode";
import SwiperCore, { Autoplay, FreeMode, Navigation, Scrollbar } from "swiper";
import { styled } from "@mui/material";

SwiperCore.use([Scrollbar,FreeMode, Autoplay, Navigation]);

//-----------style to swiper by: styled()
let Swip = styled(Swiper)(({ theme }) => ({
    padding: 17,
    paddingBottom: 35,
    width: "90%",
    "& .swiper-wrapper": { padding: 0 },
    
}));
export default function Brands() {
  return( …
Run Code Online (Sandbox Code Playgroud)

reactjs swiper.js

10
推荐指数
1
解决办法
7126
查看次数

标签 统计

reactjs ×1

swiper.js ×1