slide 처리

This commit is contained in:
focp212@naver.com
2025-11-13 15:16:38 +09:00
parent bf2a3f7dcc
commit d5b9448ec4

View File

@@ -20,6 +20,7 @@ export const FavoriteWrapper = ({
}: FavoriteWrapperProps) => { }: FavoriteWrapperProps) => {
const { navigate } = useNavigate(); const { navigate } = useNavigate();
const { i18n, t } = useTranslation(); const { i18n, t } = useTranslation();
const [swiperInstance, setSwiperInstance] = useState<any>(null);
const { menuOn, setMenuOn } = useMenuOnStore(); const { menuOn, setMenuOn } = useMenuOnStore();
const { favoriteEditOn, setFavoriteEditOn } = useFavoriteEditOnStore(); const { favoriteEditOn, setFavoriteEditOn } = useFavoriteEditOnStore();
@@ -34,6 +35,12 @@ export const FavoriteWrapper = ({
iconFilePath: IMAGE_ROOT + '/ico_menu_plus.svg', iconFilePath: IMAGE_ROOT + '/ico_menu_plus.svg',
programPath: '', programPath: '',
}; };
const goToLastSlide = () => {
if(swiperInstance){
swiperInstance.slideTo(swiperInstance.slides.length - 1);
}
};
const onClickToFavoriteEdit = () => { const onClickToFavoriteEdit = () => {
setMenuOn(true); setMenuOn(true);
@@ -130,12 +137,18 @@ export const FavoriteWrapper = ({
}; };
useEffect(() => { useEffect(() => {
goToLastSlide();
getFavoriteList(); getFavoriteList();
}, [changeMenuId, favoriteEditOn]); }, [changeMenuId, favoriteEditOn]);
useEffect(() => {
goToLastSlide();
}, [menuIds]);
return ( return (
<> <>
<Swiper <Swiper
onSwiper={ setSwiperInstance }
spaceBetween={ 9 } spaceBetween={ 9 }
slidesPerView={ 4 } slidesPerView={ 4 }
style={{height: ((usingType === 'home') && (favoriteItems.length < 1))? '0px': '75px'}} style={{height: ((usingType === 'home') && (favoriteItems.length < 1))? '0px': '75px'}}