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