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

Thumbs gallery loop cannot use virtual #6722

Closed
6 tasks done
hwd-2020 opened this issue Jun 1, 2023 · 0 comments
Closed
6 tasks done

Thumbs gallery loop cannot use virtual #6722

hwd-2020 opened this issue Jun 1, 2023 · 0 comments
Labels

Comments

@hwd-2020
Copy link

hwd-2020 commented Jun 1, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/embed/naughty-shape-vmwgrb?fontsize=14&hidenavigation=1&theme=dark

Bug description

如果使用了 virtual 就不能使用缩略图模式

<template>
  <div class="swiper">
    <Swiper
      virtual
      :initial-slide="index"
      :thumbs="{ swiper: thumbsSwiper }"
      :modules="[Navigation, Thumbs, Virtual]"
      class="mySwiper2"
    >
      <SwiperSlide v-for="l in list" :key="l">
        <img :src="l" />
      </SwiperSlide>
    </Swiper>

    <Swiper
      @swiper="setThumbsSwiper"
      virtual
      :slidesPerView="5"
      freeMode
      watchSlidesProgress
      :modules="[FreeMode, Thumbs, Virtual]"
      class="mySwiper"
    >
      <SwiperSlide v-for="l in list" :key="l">
        <img :src="l" />
      </SwiperSlide>
    </Swiper>
  </div>
</template>

<script setup>
// Import Swiper Vue.js components
import { Swiper, SwiperSlide } from "swiper/vue";

// Import Swiper styles
import "swiper/css";

import "swiper/css/free-mode";
import "swiper/css/navigation";
import "swiper/css/thumbs";
import "swiper/css/virtual";

import "./styles.css";

// import required modules
import { FreeMode, Navigation, Thumbs, Virtual } from "swiper";

const index = 5;

const list = [
  "https://swiperjs.com/demos/images/nature-1.jpg",
  "https://swiperjs.com/demos/images/nature-2.jpg",
  "https://swiperjs.com/demos/images/nature-3.jpg",
  "https://swiperjs.com/demos/images/nature-4.jpg",
  "https://swiperjs.com/demos/images/nature-5.jpg",
  "https://swiperjs.com/demos/images/nature-6.jpg",
  "https://swiperjs.com/demos/images/nature-7.jpg",
  "https://swiperjs.com/demos/images/nature-8.jpg",
  "https://swiperjs.com/demos/images/nature-9.jpg",
  "https://swiperjs.com/demos/images/nature-10.jpg",
];

let thumbsSwiper = null;

const setThumbsSwiper = (swiper) => {
  thumbsSwiper = swiper;
};
</script>

Expected Behavior

No response

Actual Behavior

No response

Swiper version

9.3.2

Platform/Target and Browser Versions

edge

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@hwd-2020 hwd-2020 added the Vue label Jun 1, 2023
@hwd-2020 hwd-2020 closed this as completed Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant