Skip to content

Commit ecb3c15

Browse files
committed
keep component alive during page transition
surmon-china#388
1 parent cf696a7 commit ecb3c15

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/swiper.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
type: Object,
8585
required: false,
8686
default: () => ({})
87+
},
88+
cleanStylesOnDestroy: {
89+
type: Boolean,
90+
required: false,
91+
default: true
8792
}
8893
},
8994
data() {
@@ -122,7 +127,7 @@
122127
beforeDestroy() {
123128
this.$nextTick(function() {
124129
if (this.swiper) {
125-
this.swiper.destroy && this.swiper.destroy()
130+
this.swiper.destroy && this.swiper.destroy(true, this.cleanStylesOnDestroy)
126131
delete this.swiper
127132
}
128133
})

0 commit comments

Comments
 (0)