test onMount
This commit is contained in:
parent
ecc1b8feec
commit
0466eef16b
|
@ -1,6 +1,6 @@
|
||||||
import { For, Show } from 'solid-js'
|
import { For, onMount, Show } from 'solid-js'
|
||||||
import { Icon } from '../Icon'
|
import { Icon } from '../Icon'
|
||||||
import { register } from 'swiper/element'
|
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'
|
||||||
|
@ -13,13 +13,12 @@ type Props = {
|
||||||
title?: string
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
register()
|
|
||||||
|
|
||||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
|
||||||
|
|
||||||
export const ArticleCardSwiper = (props: Props) => {
|
export const ArticleCardSwiper = (props: Props) => {
|
||||||
const mainSwipeRef: { current: SwiperRef } = { current: null }
|
const mainSwipeRef: { current: SwiperRef } = { current: null }
|
||||||
|
onMount(() => {
|
||||||
|
register()
|
||||||
|
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.Swiper, styles.articleMode, styles.ArticleCardSwiper)}>
|
<div class={clsx(styles.Swiper, styles.articleMode, styles.ArticleCardSwiper)}>
|
||||||
<Show when={props.title}>
|
<Show when={props.title}>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { createEffect, createSignal, For, Show, on } from 'solid-js'
|
import { createEffect, createSignal, For, Show, on, onMount } from 'solid-js'
|
||||||
import { MediaItem, UploadedFile } from '../../../pages/types'
|
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'
|
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'
|
||||||
|
@ -28,10 +28,6 @@ type Props = {
|
||||||
onImageChange?: (index: number, value: MediaItem) => void
|
onImageChange?: (index: number, value: MediaItem) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
register()
|
|
||||||
|
|
||||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
|
||||||
|
|
||||||
export const ImageSwiper = (props: Props) => {
|
export const ImageSwiper = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const [loading, setLoading] = createSignal(false)
|
const [loading, setLoading] = createSignal(false)
|
||||||
|
@ -139,6 +135,11 @@ export const ImageSwiper = (props: Props) => {
|
||||||
handleSlideDescriptionChange(slideIndex(), 'body', slideBody())
|
handleSlideDescriptionChange(slideIndex(), 'body', slideBody())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
register()
|
||||||
|
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.Swiper, props.editorMode ? styles.editorMode : styles.articleMode)}>
|
<div class={clsx(styles.Swiper, props.editorMode ? styles.editorMode : styles.articleMode)}>
|
||||||
<div class={styles.container}>
|
<div class={styles.container}>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user