I
I
Igor2019-12-21 23:20:37
Vue.js
Igor, 2019-12-21 23:20:37

Global mixin, called mounted multiple times on initialization?

Colleagues, welcome!
The project has a global mixin.
The mixin is mounted as a plugin.
In the mounted lifecycle event, I put the output function in the console and what did I see there?

mounted() {
    console.log("Main mixin mounted")
  }

5dfe7e62e6dcd944037034.png
Is this a framework bug or am I doing something wrong.
I expected the mount to happen only once.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
�
ⓒⓢⓢ, 2019-12-21
@IgorPI

What is actually happening is a guess
. But, in simple words, the mixin in each component (that use this mixin) "injects" methods.
Here you have a hook handler "embedded" in 31 components

mounted() {
console.log("Main mixin mounted")
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question