Answer the question
In order to leave comments, you need to log in
How to fix error when displaying swiper slider in Nuxt?
Good day!
Swper I put for the first time on Nuxt I
put it through npm
in the config I registered
plugins: [
{ src: '~plugins/swiper', ssr: false }
],
import Vue from 'vue'
import VueAwesomeSwiper from 'vue-awesome-swiper'
Vue.use(VueAwesomeSwiper, /* { default global options } */)
<template>
<div>
<swiper :options="swiperOption">
<swiper-slide
v-for="(item, i) in sliders"
:key="i"
>
<div class="item-slider">
<div class="col-cont slider">
<div class="slider__title">{{item[`title_${$i18n.locale}`]}}</div>
<div class="slider__content">
{{item[`description_${$i18n.locale}`]}}
</div>
<a @click="openItem(item.slug)" class="btn btn-order">{{$t('portfolio.order_consult')}}</a>
<div class="slider__signature"></div>
</div>
<div class="col-img slider__img-block">
<img :src="url_img + item.img" :alt="item[`title_${$i18n.locale}`]">
</div>
</div>
</swiper-slide>
</swiper>
<div class="slider__paginate">
<div class="swiper-pagination" slot="pagination"></div>
<div class="swiper-button-prev" slot="button-prev"></div>
<div class="swiper-button-next" slot="button-next"></div>
</div>
</div>
</template>
<script>
export default {
props: {
sliders: {
type: Array,
default() {
return {}
}
}
},
name: 'SliderItem',
data() {
return {
swiperOption: {
pagination: {
el: '.swiper-pagination',
type: 'fraction'
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
}
},
url_img: process.env.baseImgUrl
}
},
methods: {
openItem(slug){
this.$router.push(`/blog/${slug}`)
}
},
}
</script>
<style scoped>
</style>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question