Swiper (init with promise)
This commit is contained in:
parent
66ed666b90
commit
78cde31943
|
@ -49,12 +49,17 @@ export const ImageSwiper = (props: Props) => {
|
|||
)
|
||||
|
||||
onMount(async () => {
|
||||
console.log("!!! onMount:");
|
||||
const { register } = await import('swiper/element/bundle')
|
||||
register()
|
||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||
mainSwipeRef.current?.swiper?.on('slideChange', handleSlideChange)
|
||||
while (!mainSwipeRef.current || !mainSwipeRef.current.swiper) {
|
||||
await new Promise(resolve => setTimeout(resolve, 10)); // wait 10 ms
|
||||
}
|
||||
mainSwipeRef.current.swiper.on('slideChange', handleSlideChange);
|
||||
})
|
||||
|
||||
|
||||
onMount(() => {
|
||||
const updateDirection = () => {
|
||||
const width = window.innerWidth
|
||||
|
|
Loading…
Reference in New Issue
Block a user