Cannot read property 'classList' error

Hi. I get the error Cannot read property 'classList' of undefined when I navigate back using the browser’s back button and when I use this.$router.go(-1);. I believe I am using the latest vue-router and ionic/vue-router

package.json

  "dependencies": {
    "@capacitor/android": "^2.4.2",
    "@capacitor/core": "2.4.2",
    "@capacitor/ios": "^2.4.2",
    "@ionic/cli": "^6.12.2",
    "@ionic/pwa-elements": "^3.0.1",
    "@ionic/vue": "^5.4.0",
    "@ionic/vue-router": "^5.5.4",
    "core-js": "^3.6.5",
    "global": "^4.4.0",
    "node-sass": "^5.0.0",
    "sass-loader": "^10.1.0",
    "vue": "^3.0.0-0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-rc.1"
  },
  "devDependencies": {
    "@capacitor/cli": "2.4.2",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-e2e-cypress": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0-0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "@vue/test-utils": "^2.0.0-0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0",
    "vue-jest": "^5.0.0-0"
  },

Ionic Info

Ionic:

   Ionic CLI       : 6.11.8-testing.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 5.5.4

Capacitor:

   Capacitor CLI   : 2.4.2
   @capacitor/core : 2.4.2

Utility:

   cordova-res (update available: 0.15.2) : 0.15.1
   native-run                             : not installed

System:

   NodeJS : v12.18.0 (/usr/local/bin/node)
   npm    : 6.14.4
   OS     : macOS Catalina


  ───────────────────────────────────────────────────────────

     Ionic CLI update available: 6.11.8-testing.0 β†’ 6.12.2
               Run npm i -g @ionic/cli to update

  ───────────────────────────────────────────────────────────

Here is the repo

Hi! I have the same error, did you find a workaround?

I started getting this error today, while i was playing around with tabs template. what i found is that both the page β€˜to’ & β€˜from’ Or β€˜from’ & β€˜to’ in both cases the pages needs to have Ion-page tag wrapper

Hi @epaulk. Yes, this was answered on Github. @nvispute is right make sure you have ion-page wrapper on your page.

2 Likes