[Vuejs]-Hide/disable VueJs Component

0👍

You can achieve this by using navigation guards

router.beforeEach(async (to, from) => {
  if (
    // make sure the user is authenticated
    !isAuthenticated &&
    // Avoid an infinite redirect
    to.name !== 'Login'
  ) {
   // redirect the user to the login page
    return { name: 'Login' }
  }
})

Documentation with more complex examples

Leave a comment