Обновление Swiper до 10-й версии

This commit is contained in:
Valentin Silytuin 2023-08-28 13:07:44 +04:00
parent 6bcd9a2da3
commit ba5307fc1e
3 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@
## Требования
- [Swiper](https://github.com/nolimits4web/swiper) версии 4.5.x
- [Swiper](https://github.com/nolimits4web/swiper) версии ^10.2.0
## Подключение и настройка

View File

@ -97,8 +97,10 @@ const show = async (duration = 500, easing = 'linear') => {
};
const init = async (items = [], options = {}, index = 0) => {
const {Swiper, Navigation, Pagination} = await import('swiper');
Swiper.use([Navigation, Pagination]);
const [{default: Swiper}, {Navigation, Pagination}] = await Promise.all([
import('swiper'),
import('swiper/modules'),
]);
let isVideoInGallery = false;
items = items.map((item) => {
@ -153,7 +155,7 @@ const init = async (items = [], options = {}, index = 0) => {
<button class="advdominion-lg__close" type="button">
<svg class="advdominion-lg__close-icon"><use href="${options.icons.close}" /></svg>
</button>
<div class="advdominion-lg__container swiper-container">
<div class="advdominion-lg__container swiper">
<div class="advdominion-lg__wrapper swiper-wrapper">
${items.join('')}
</div>
@ -170,7 +172,7 @@ const init = async (items = [], options = {}, index = 0) => {
const swiper = new Swiper(
gallery.querySelector('.advdominion-lg__container'),
Object.assign({init: false, initialSlide: index}, options.swiper)
Object.assign({modules: [Navigation, Pagination], init: false, initialSlide: index}, options.swiper)
);
swiper.on('init', function () {

View File

@ -13,6 +13,6 @@
"@advdominion/get-scrollbar-width": "^1.0.0"
},
"peerDependencies": {
"swiper": "4.5.1"
"swiper": "^10.2.0"
}
}