question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property '$swiper' of undefined

See original GitHub issue

code:

import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
<swiper ref="mySwiper">
......
</swiper>
computed: {
      swiper () {
        return this.$refs.mySwiper.$swiper
      }
},
activated () {
      this.swiper.slideNext(1000)
}

error:

vue.esm.js?65d7:628 [Vue warn]: Error in activated hook: “TypeError: Cannot read property ‘$swiper’ of undefined”

According to the official instructions configuration, do not know why can not find

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
frontendjordancommented, Jun 23, 2020

Getting the same error in 4.1.1. Have tried .swiper and .$swiper with no luck

2reactions
Web-Licommented, Jun 11, 2020

beacuse of different version, when i use v3.1.3, it’s swiper, when i use v4.1.1, it’s $swiper

Read more comments on GitHub >

github_iconTop Results From Across the Web

swiper instance: Cannot read properties of undefined ... - GitHub
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 >
Cannot set property 'Swiper' of undefined - Stack Overflow
You just need to look onto your gulpfile.js under plugin.babel and look at the ignore section and just add swiper.js to the array....
Read more >
Can't access swiper js instance of a glider - WordPress.org
I have been using the following code to manipulate settings of swiper that are not ... Uncaught TypeError: Cannot read properties of undefined...
Read more >
nolimits4web/Swiper - Gitter
Uncaught TypeError : Cannot read property 'offsetWidth' of undefined .scrollbar.set @ swiper.js:2555 .onResize @ swiper.js:999.
Read more >
All Swiper.js Instances in Elementor are Now Exposed
Elementor uses Swiper, an external JS library, to power all of the sliders and carousels in ... the code fires “cannot read property...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found