Cannot read property 'swiper' of undefined" when 'not-next-tick:true' in mounted
See original GitHub issuetemplate:
<swiper :options="swiperOption" :not-next-tick="notNextTick" ref="mySwiper">
<slide v-for="item in XXX">
</swiper
script:
data:{
notNextTick: true,
swiperOption: {
initialSlide: 0,
onlyExternal: true,
onInit: (swiper) => {
console.log(swiper)
},
onReachEnd: (swiper) => {
console.log('last slide')
}
}
},
computed: {
swiper () {
return this.$refs.mySwiper.swiper
}},
mounted () {
console.log(this)
console.log(this.swiper)
}
all above is my real code refered to README/#Use in SPA
error in broswer and never console
I need swiper instance first time,but I can’t get it Someone else know why and how?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
React Swiper: Uncaught (in promise) TypeError: Cannot read ...
I am validating first if there are any images available on my images property or not, if there is an image then render...
Read more >Getting Started With Swiper
Installation. There are few options on how to include/import Swiper into your project: Install from NPM. We can install Swiper from NPM $...
Read more >nolimits4web/Swiper - Gitter
Uncaught TypeError : Cannot read property 'offsetWidth' of undefined .scrollbar.set @ swiper.js:2555 .onResize @ swiper.js:999.
Read more >Changing slides using buttons above swiper - Ionic Forum
Since Swiper is not initialized before the button, ... Uncaught TypeError: Cannot read properties of null (reading 'slideNext'). Thanks!
Read more >how to get current slide element index in swiper js react
When using event listeners on swiper instance error TypeError: Cannot read properties of undefined (reading 'event_name') occur where event_name is the name ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The reason for the real mistake is that this swiper’s parent has v-if, change v-if to v-show
I am also facing the same issue, on initial load it is showing the swiperobject but once I route and come back to that same page, I do face that issue.