[Vuejs]-VueJS & TS : Error on hiding a component on specific page

0👍

Not 100% sure as I use vuex to store user login and then simple v-if’s on specific components in App.vue to show or hide components as desired. This is also in the context of a index.js file the vue-router with beforeEach hooks. With that said, computed properties are cached so it appears that your isLogin computed property is returning the error when this.$route.name is "undefined" at build. I believe that something along the lines of below may work.

`isLogin() {
 return this.$route.name != "undefined" 
      ? !['Login'].includes(this.$route.name)
      : false (or true depending on your desire)

}`

Again, not 100% sure as I am not fully aware of the approach you are using. Either way, hope someone else can provide the solution if this isn’t it.

Leave a comment