【发布时间】:2021-12-30 16:07:36
【问题描述】:
我正在使用 swiperjs,但我在制作幻灯片时遇到了困难
因为他们不会捕捉到下一张幻灯片,我无法从他们那里获得活动索引这是我的代码
我在哪里出错了我在 ionic 框架中使用 typescript 和 swiperjs 6.84 版
import 'swiper/components/navigation/navigation.min.css'
import 'swiper/components/pagination/pagination.min.css'
const pagination = {
clickable: true,
};
return (
<IonPage>
<Swiper
pagination={pagination}
onBeforeSlideChangeStart={e => {
setIndex(e.activeIndex)
}}>
<SwiperSlide >
<item property={property} index={0} save={dispatch} activeIndex={index} />
</SwiperSlide>
<SwiperSlide >
<item 2 property={property} index={1} />
</SwiperSlide>
<SwiperSlide >
<item3 property={property} index={1} />
</SwiperSlide>
</Swiper>
<IonButton
disabled={true}
onClick={(e) => {
e.preventDefault();
}}
className={"next"}
expand={"block"}
>
Save
</IonButton>
</IonPage>
);
}
【问题讨论】:
-
您看到了什么行为?在此处查看示例 - codesandbox.io/s/reactjs-swiperjs-dynamic-slides-oesuw?file=/…
-
当我移动它时它没有反应我试图将观察者和观察者父级添加到 true 但它只是让我的组件在一张太长的幻灯片中正常工作我该怎么办??跨度>
标签: javascript reactjs typescript ionic-framework swiperjs