Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

313
Views
Ejemplo de control deslizante SwiperJs con API de opción Vue3

¿Alguien puede mostrarme un ejemplo del control deslizante SwiperJs, usando la opción Vue3 api, no la composición Api?
Me refiero a javascript puro con plantilla dentro del html.

me gusta

 <div> <div slider container> <div vfor> </div> </div> </div>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puedes usar algo como esto:

 <template> <div :id="id" class="swiper-container" > <div class="swiper-wrapper" @click="$emit('click')" > <!-- swipe right template --> <template v-if="direction === 'right'"> <v-list-item class="swiper-slide" /> <v-list-item class="swiper-slide"> <v-list-item-content> <slot /> </v-list-item-content> </v-list-item> </template> <!-- swipe left template --> <template v-if="direction === 'left'"> <v-list-item class="swiper-slide"> <v-list-item-content> <slot /> </v-list-item-content> </v-list-item> <v-list-item class="swiper-slide" /> </template> </div> </div> </template> <script> import 'swiper/dist/css/swiper.min.css'; import { Swiper } from 'swiper/dist/js/swiper.esm.js'; export default { props: { id: { type: [String, Number], required: true }, direction: { type: String, default: 'right', validator: value => ['right', 'left'].indexOf(value) !== -1 } }, mounted () { const self = this; const el = '#' + this.id; const direction = this.direction; // Initialize Swiper const swiper = new Swiper(el, { initialSlide: this.direction === 'left' ? 0 : 1, resistanceRatio: 0, speed: 150, observer: true, observeParents: true, }); // Event will be fired after transition swiper.on('transitionEnd', function () { const activeIndex = this.activeIndex; if ((direction === 'right' && activeIndex === 0) || (direction === 'left' && activeIndex === 1)) { self.$emit('swiped'); // Destroy slider instance and detach all events listeners this.destroy(); } }); } }; </script>
about 4 years ago · Juan Pablo Isaza Report

0

El uso puede usar así

 <template> <swiper :slides-per-view="4" :space-between="30" @swiper="onSwiper" @slideChange="onSlideChange" class="default-slider" > <swiper-slide v-for="item in items" :key="item"> <img :src="item" /> </swiper-slide> </swiper> </template> <script> import { Swiper, SwiperSlide } from 'swiper/vue'; export default { components: { Swiper, SwiperSlide, }, data() { return { items: ['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg'] } } } </script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!