async swiper load
This commit is contained in:
parent
0466eef16b
commit
8ac7b104a8
|
@ -1,6 +1,6 @@
|
||||||
import { For, onMount, Show } from 'solid-js'
|
import { For, onMount, Show } from 'solid-js'
|
||||||
import { Icon } from '../Icon'
|
import { Icon } from '../Icon'
|
||||||
import { register } from 'swiper/element/bundle'
|
|
||||||
import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper'
|
import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper'
|
||||||
import { SwiperRef } from './swiper'
|
import { SwiperRef } from './swiper'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
|
@ -15,7 +15,8 @@ type Props = {
|
||||||
|
|
||||||
export const ArticleCardSwiper = (props: Props) => {
|
export const ArticleCardSwiper = (props: Props) => {
|
||||||
const mainSwipeRef: { current: SwiperRef } = { current: null }
|
const mainSwipeRef: { current: SwiperRef } = { current: null }
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
|
const { register } = await import('swiper/element/bundle')
|
||||||
register()
|
register()
|
||||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { MediaItem, UploadedFile } from '../../../pages/types'
|
||||||
import { Icon } from '../Icon'
|
import { Icon } from '../Icon'
|
||||||
import { Popover } from '../Popover'
|
import { Popover } from '../Popover'
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
import { register } from 'swiper/element/bundle'
|
|
||||||
import { DropArea } from '../DropArea'
|
import { DropArea } from '../DropArea'
|
||||||
import { createFileUploader } from '@solid-primitives/upload'
|
import { createFileUploader } from '@solid-primitives/upload'
|
||||||
import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper'
|
import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper'
|
||||||
|
@ -135,7 +134,8 @@ export const ImageSwiper = (props: Props) => {
|
||||||
handleSlideDescriptionChange(slideIndex(), 'body', slideBody())
|
handleSlideDescriptionChange(slideIndex(), 'body', slideBody())
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
|
const { register } = await import('swiper/element/bundle')
|
||||||
register()
|
register()
|
||||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user