Vue-awesome-swiper: Update to docs to swiper 6.0

Created on 4 Jul 2020  Â·  11Comments  Â·  Source: surmon-china/vue-awesome-swiper

https://swiperjs.com/get-started/

import 'swiper/css/swiper.css'

is outdated, use

import 'swiper/swiper-bundle.css';

Swiper 6

Most helpful comment

Is there something different for adding the pagination as well?

All 11 comments

+1

+1

up!!!!!

谢谢

Only this change is required from 5 to 6 @gustawdaniel ?

nice!

Is there something different for adding the pagination as well?

it's a good iss

最新的版本会报错
TypeError: Cannot set property 'params' of undefined
at SwiperClass (swiper.js?9b44:1038)
at Swiper (swiper.js?9b44:3716)
at resolveAsyncComponent (vue.esm.js?efeb:3695)
at createComponent (vue.esm.js?efeb:3209)
at _createElement (vue.esm.js?efeb:3431)
at createElement (vue.esm.js?efeb:3362)
at vm._c (vue.esm.js?efeb:3500)
at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-4c228a82","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/bundles/screenBundle/dataStatistics/modules/centerContent/modules/screenProjection/components/media/index.vue (0.js:4439), :9:7)

最新的版本会报错
TypeError: Cannot set property 'params' of undefined
at SwiperClass (swiper.js?9b44:1038)
at Swiper (swiper.js?9b44:3716)
at resolveAsyncComponent (vue.esm.js?efeb:3695)
at createComponent (vue.esm.js?efeb:3209)
at _createElement (vue.esm.js?efeb:3431)
at createElement (vue.esm.js?efeb:3362)
at vm._c (vue.esm.js?efeb:3500)
at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-4c228a82","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/bundles/screenBundle/dataStatistics/modules/centerContent/modules/screenProjection/components/media/index.vue (0.js:4439), :9:7)

If you use vue-awesome-swiper@3.x , the correct code is:

import { swiper, swiperSlide } from 'vue-awesome-swiper

else if you use vue-awesome-swiper@4.x, the correct code is:

import { Swiper, SwiperSlide } from 'vue-awesome-swiper

pay attention to the capitalize,s <-> S

Vue Awesome Swiper readme was updated with instructions for targeting different versions of Swiper.js

Was this page helpful?
0 / 5 - 0 ratings