Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: swiper-container :init="false" The method returned by useSwiper … #140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LUDA0831
Copy link

fix: swiper-container :init="false" The method returned by useSwiper will not work)](fix: swiper-container :init="false" The method returned by useSwiper will not work #139

Copy link

codesandbox bot commented Nov 19, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@@ -82,6 +83,7 @@ export function useSwiper(swiperContainerRef: Ref<SwiperContainer | null>, optio
Object.assign(swiperContainerRef.value, options)
swiperContainerRef.value?.initialize()
}
swiper.value = swiperContainerRef?.value?.swiper
Copy link

@Quineone Quineone Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It confused me,the value of 'swiperContainerRef?.value?.swiper' is reactive, but 'swiper.value' is not. You can resize the swiper and check the value of them. (eg. isLocked, isEnd, isBeginning, ...)

for now, I have to workaround by using the events:

on: {
    resize(swiper: Swiper) {
      isLocked.value = swiper.isLocked
      isEnd.value = swiper.isEnd
      isBeginning.value = swiper.isBeginning
    },
    slideChange(swiper: Swiper) {
      isEnd.value = swiper.isEnd
      isBeginning.value = swiper.isBeginning
    }
  }

@Nks
Copy link

Nks commented Jan 30, 2025

Hey, guys. Do you have an ETA on merging this PR? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants