Open ShekhSaifuddin007 opened 4 years ago
try this
methods: {
show () {
this.$modal.show('quick-view');
this.$nextTick(() => {
const swiperTop = this.$refs.swiperTop.$swiper
const swiperThumbs = this.$refs.swiperThumbs.$swiper
swiperTop.controller.control = swiperThumbs
swiperThumbs.controller.control = swiperTop
})
},
}
Same error show after open modal š
I have created a reusable modal like my own and I have seen the same problem there, š help me, anybody, plz..
@surmon-china plz. help me
The error does not state, that there is no $swiper, the error states, that it can't read $swiper from something, that is undefined. So your issue seem to be, that the $refs does not contain your elements. Maybe that helps you, to look further, why vue does not have your $refs available in that situation.
I think the modal component might use a v-if to show or hide the element, and when the whole modal is not shown, it is removed from the DOM and thus there is no way $refs are available. You either check if the ref is present and execute your code then or (if that is possible) you could use v-show instead of v-if to hide the modal.
So in general it seems to work: https://jsfiddle.net/3mbkfrnj/
I'm using this modal plugin vue-js-modal . I'm trying to make an image gallery inside the modal. outside this modal, it's work I aspected but inside modal, it shows me the error and does not work properly
My code image gallery