This is best way I have found of achieving what you're looking for is with the follow code:
In my template
<swiper ref="swiper">
<swiper-slide></swiper-slide>
<swiper-slide></swiper-slide>
</swiper>
<a class="swiper-navigation is-previous" @click="swiper.slidePrev()"></a>
<a class="swiper-navigation is-next" @click="swiper.slideNext()"></a>
And then in my javascript
computed: {
swiper() {
return this.$refs.swiper.swiper;
}
}
Yeah, basically I did the same by wrapping a swiper into an additional outer wrapper like so:
<template>
<div class="swiper-outer-wrapper">
<div class="swiper" v-swiper:mySwiper="swiperOptions">
<div class="swiper-wrapper">
<div class="swiper-slide" :class="itemClass" v-for="(item,index) in items">
<img :src="item.image_url">
</div>
</div>
<div class="swiper-pagination"></div>
</div>
<div class="swiper-button-prev">
<button
class="swiper-button-default"
@click.stop.prevent="slidePrev"
aria-label="Previous"
type="button"
title="Previous">
<icon class="icon-arrow" name="arrows/arrow-right-md" dir="down" :original="true"></icon>
</button>
</div>
<div class="swiper-button-next">
<button
class="swiper-button-default"
aria-label="Next"
@click.stop.prevent="slideNext"
type="button"
title="Next">
<icon class="icon-arrow" name="arrows/arrow-right-md" :original="true"></icon>
</button>
</div>
</div>
</template>
and then I'm just triggering those slider functions from my methods object. I can't understand why this additional wrapepr is not there by default. Having controls outside the slider itself is very common and cutting it with overflow feels counter-intuitive to me
I wasn't able to pull pagination out that easily though
@AndrewBogdanovTSS Hello, Can you explain how u achieved to use controls outside of swiper please?
@Bobur-kobilov actually I've already explained above. The only thing that can't be pulled out that easily is pagination since it's generated by slider itself but you can override that option by creating your own. A bit tidious, but it'll work
thank you! i solved it
Most helpful comment
This is best way I have found of achieving what you're looking for is with the follow code:
In my template
And then in my javascript