Looping custom component inside swiper-slide not rendering content but renders structure
See original GitHub issueLooping custom component inside swiper-slide
not rendering content but it renders the structure and swiper swiping works.
It works if I remove the swiper-slide
around the component I wanted into the slide. But I think the library is not meant to be used without the swiper-slide
correct me if I am wrong?
Also the directive for the library is not working!! So I cannot make my own structure.
This is what is going on:
<template>
<swiper
ref="productSlider"
:options="swiperOptions"
class="product-slider"
@slideChange="onSlideChange"
>
<swiper-slide
v-for="item in items"
:key="item.id"
>
<product-slide :item="item" />
</swiper-slide>
<div
slot="pagination"
class="product-slider__pagination"
/>
</swiper>
</template>
<script>
import 'swiper/dist/css/swiper.css';
import { swiper, swiperSlide } from 'vue-awesome-swiper';
import ProductSlide from './ProductSlide.vue';
export default {
name: 'ProductSlider',
components: {
swiper,
swiperSlide,
ProductSlide,
},
props: {
items: {
type: Array,
default: () => [],
required: true,
},
},
data() {
const self = this;
return {
isQuickviewEnabled: false,
swiperOptions: {
direction: 'vertical',
loopedSlides: 1,
spaceBetween: 30,
slidesPerView: 1,
effect: 'fade',
loop: true,
mousewheel: {
invert: false,
},
// autoHeight: true,
pagination: {
el: '.product-slider__pagination',
clickable: true,
dynamicBullets: true,
dynamicMainBullets: 1,
},
},
};
},
computed: {
swiper() {
return this.$refs.productSlider.swiper;
},
},
watch: {
items(newValue, oldValue) {
// if (this.swiper) {
// console.log(this.items);
// this.$nextTick(() => {
// this.swiper.loopDestroy();
// this.swiper.loopCreate();
// });
// }
},
},
methods: {
onSlideChange() {
console.log('Slide did change');
},
}
};
</script>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:5
Top Results From Across the Web
Swiper.js SwiperSlide render props not working properly with ...
I'm kinda stucked into a problem where isPrev and isNext SwiperSlide render props are not working correctly in a Swiper with loop prop...
Read more >Swiper Changelog
paginationCustomRender(swiper, current, total) - custom function to render "custom" type pagination. New lazyLoadingInPrevNextAmount parameter allows to lazy ...
Read more >Safari Technology Preview Release Notes - Apple Developer
Safari Technology Preview Release Notes. Release 160. Note: Shared Tab Groups and syncing for Tab Groups, Website Settings, and Web Extensions are not...
Read more >React Swiper.js Slider - DEV Community
Introduction In fact, today's article is devoted not only to how to make a specific slider, which... Tagged with react, javascript, tutorial ...
Read more >Building modern sliders with HTML, CSS, and Swiper
Containers, or the boxes that house the slider components ... HTML markup to structure our project web page, layout, and its contents are ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i added this to swiper config and it works
@artforteam2015 Solution worked for me but I cannot perform any event on custom component.