Skip to content

Commit

Permalink
feat(swiper): remove support for auto init with "swiper-init" in favo…
Browse files Browse the repository at this point in the history
…r of Swiper custom element
  • Loading branch information
nolimits4web committed Jan 16, 2023
1 parent 2bff538 commit 35367f8
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/core/components/swiper/swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default {
on: {
pageBeforeRemove(page) {
const app = this;
page.$el.find('.swiper-init, .tabs-swipeable-wrap').each((swiperEl) => {
page.$el.find('.tabs-swipeable-wrap').each((swiperEl) => {
app.swiper.destroy(swiperEl);
});
},
Expand All @@ -131,29 +131,29 @@ export default {
},
pageInit(page) {
const app = this;
page.$el.find('.swiper-init, .tabs-swipeable-wrap').each((swiperEl) => {
page.$el.find('.tabs-swipeable-wrap').each((swiperEl) => {
initSwiper.call(app, swiperEl);
});
},
pageReinit(page) {
const app = this;
page.$el.find('.swiper-init, .tabs-swipeable-wrap').each((swiperEl) => {
page.$el.find('.tabs-swipeable-wrap').each((swiperEl) => {
const swiper = app.swiper.get(swiperEl);
if (swiper && swiper.update) swiper.update();
});
},
tabMounted(tabEl) {
const app = this;
$(tabEl)
.find('.swiper-init, .tabs-swipeable-wrap')
.find('.tabs-swipeable-wrap')
.each((swiperEl) => {
initSwiper.call(app, swiperEl);
});
},
tabShow(tabEl) {
const app = this;
$(tabEl)
.find('.swiper-init, .tabs-swipeable-wrap')
.find('.tabs-swipeable-wrap')
.each((swiperEl) => {
const swiper = app.swiper.get(swiperEl);
if (swiper && swiper.update) swiper.update();
Expand All @@ -162,25 +162,13 @@ export default {
tabBeforeRemove(tabEl) {
const app = this;
$(tabEl)
.find('.swiper-init, .tabs-swipeable-wrap')
.find('.tabs-swipeable-wrap')
.each((swiperEl) => {
app.swiper.destroy(swiperEl);
});
},
},
vnode: {
'swiper-init': {
insert(vnode) {
const app = this;
const swiperEl = vnode.elm;
initSwiper.call(app, swiperEl);
},
destroy(vnode) {
const app = this;
const swiperEl = vnode.elm;
app.swiper.destroy(swiperEl);
},
},
'tabs-swipeable-wrap': {
insert(vnode) {
const app = this;
Expand Down

0 comments on commit 35367f8

Please sign in to comment.