chudy91
chudy91

Reputation: 476

Mounted lifecycle hook - difference between Vue 3 and Vue 2

my company migrates project from Vue 2 to Vue 3 and we’ve encountered some troubles with lifecycle hooks. Some external plugins (compatible with Vue 3) have troubles with mounting / unmounting. We didn’t change the way we call them in our project. It seems that Vue 3 mounted() is slightly different than Vue 2 version. It looks that in Vue 3 mounted() starts before DOM is completely loaded and it causes errors - plugins try to initialize in DOM nodes that don’t exist yet - but we initialize plugins in mounted() hook, so DOM should be already accessible. Is there any difference between Vue 2 mounted() and Vue 3 mounted()? If it matters, these are plugins that make us problems: chart.js, TinyMCEditor.

Upvotes: 0

Views: 111

Answers (0)

Related Questions