encapsulating swiper, in child components setting options in child components can take effect, but parent component setting options is invalid.
//slider.vue
<template>
<swiper :options="swiperOption">
<swiper-slide></swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</template>
<script>
export default {
name: "carrousel",
props: {
swiperOption: {
type: Object,
default () {
return {}//
}
}
}
}
</script>
//home.vue
<template>
<div>
<slider :options="swiperOption"></slider>
</div>
</template>
<script>
import Slider from "@/common/slider"
export default {
data () {
return {
swiperOption: {//
autoplay: true,
loop: true,
pagination: {
el: ".swiper-pagination"
}
}
},
components: {
Slider
}
}
</script>
have you ever encountered the same problem? I"ve been confused for a day.