Skip to content

Commit

Permalink
feat(svelte): add tag and wrapperTag props
Browse files Browse the repository at this point in the history
fixes #6181
  • Loading branch information
nolimits4web committed Nov 7, 2022
1 parent b57aa4e commit 71e7f5a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/svelte/swiper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
let className = undefined;
export { className as class };
export let tag = 'div';
export let wrapperTag = 'div';
let containerClasses = 'swiper';
let breakpointChanged = false;
let swiperInstance = null;
Expand Down Expand Up @@ -148,17 +151,18 @@
});
</script>

<div
<svelte:element
this={tag}
bind:this={swiperEl}
class={uniqueClasses(`${containerClasses}${className ? ` ${className}` : ''}`)}
{...restProps}
>
<slot name="container-start" />
<div class="swiper-wrapper">
<svelte:element this={wrapperTag} class="swiper-wrapper">
<slot name="wrapper-start" />
<slot {virtualData} />
<slot name="wrapper-end" />
</div>
</svelte:element>
{#if needsNavigation(swiperParams)}
<div bind:this={prevEl} class="swiper-button-prev" />
<div bind:this={nextEl} class="swiper-button-next" />
Expand All @@ -170,4 +174,4 @@
<div bind:this={paginationEl} class="swiper-pagination" />
{/if}
<slot name="container-end" />
</div>
</svelte:element>

0 comments on commit 71e7f5a

Please sign in to comment.