is it possible to create child class from SwiperContainer web component #7972
Unanswered
vinodkalyan055
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
import { SwiperContainer, register } from 'vendor';
// Register Swiper web components
register();
// Create custom element extending SwiperContainer
export class CarouselElement extends SwiperContainer {
constructor() {
super();
// Set Swiper configuration
Object.assign(this, {
slidesPerView: 1,
breakpoints: {
640: {
slidesPerView: 2,
},
1024: {
slidesPerView: 3,
},
},
});
}
connectedCallback() {
}
}
// Register custom element
customElements.define('carousel-element', CarouselElement);
Beta Was this translation helpful? Give feedback.
All reactions