[Vuejs]-Vue.js App Element update data

0👍

You’re currently setting up the initial value of showToolbar, but not setting it up to watch for route changes. For that to work, move showToolbar to the computed section of you App.vue vm:

export default {
  name: 'app',
  data() {
    return {
      msg: 'initial',
    }
  },
  computed: {
    showToolbar() { return this.$router.currentRoute.path !== '/login' }
  }
}

Also, since you are not explicitly importing router in App.vue, you access it in App.vue vm like this.$router, not like router.

Leave a comment