1

Как подключить SwiperJS по npm на NuxtJS?

1

1 ответ 1

1

Устанавливаешь модуль: npm install swiper vue-awesome-swiper --save

Создаешь плагин: plugins/swiper.js

import Vue from 'vue'

import { Swiper as SwiperClass, Pagination, Navigation, Mousewheel, Autoplay } from 'swiper/swiper.esm'
import getAwesomeSwiper from 'vue-awesome-swiper/dist/exporter'
SwiperClass.use([Pagination, Mousewheel, Navigation, Autoplay])

Vue.use(getAwesomeSwiper(SwiperClass))

После этого добавляешь конфигурацию в nuxt.config.js

plugins: [
    { src: '~/plugins/swiper', mode: 'client' },
  ],

Подробнее тут: https://github.com/surmon-china/vue-awesome-swiper

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.