[Vuejs]-The mounted block from the vue template is executed even when the template is not used

0👍

The monted is still running after the login form is removed from DOM. Try to add a boolean variable like this:

export default {
  data() {
    return {
      isLoggedIn: false,
      isAnimated: false,
  
    }
  },
  mounted() {
    if (this.isAnimated) {
      // animation code here
    }
  },
  methods: {
    login() {
      // authorization logic here
      this.isLoggedIn = true;
      this.isAnimated = true;

it’s not the correctly but i believe it’s works, if not working send your code here

Leave a comment