Skip to content

Commit

Permalink
fix(svelte): install modules via module component prop (#4768)
Browse files Browse the repository at this point in the history
fixes #4767
  • Loading branch information
slava-viktorov committed Jul 22, 2021
1 parent 4bd7461 commit ddaa069
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/svelte/init-swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import Swiper from '../../core';
import { needsNavigation, needsPagination, needsScrollbar } from './utils';

function initSwiper(swiperParams) {
function initSwiper(swiperParams, modules) {
if (modules) Swiper.use(modules);
return new Swiper(swiperParams);
}

Expand Down
3 changes: 2 additions & 1 deletion src/svelte/swiper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
let className = undefined;
export { className as class };
export let modules = null;
let containerClasses = 'swiper-container';
let breakpointChanged = false;
Expand Down Expand Up @@ -79,7 +80,7 @@
},
});
swiperInstance = initSwiper(swiperParams);
swiperInstance = initSwiper(swiperParams, modules);
if (swiperInstance.virtual && swiperInstance.params.virtual.enabled) {
const extendWith = {
cache: false,
Expand Down

0 comments on commit ddaa069

Please sign in to comment.