Open lucaswerkmeister opened 2 years ago
To highlight this: when using vue2 (2.7.14 in my case), in only works when using destroyed
. Thus, the existence of the unmounted
function can be misleading for vue3-used developers working on older code.
This works in Vue2:
destroyed(): void {
console.debug('destroyed');
}
This does NOT WORK in Vue2, although no compilation or runtime error is thrown:
# Does not work wiht Vue2!!
unmounted(): void {
console.debug('Office::unmounted');
}
vue-class-component 7.2.4 added a
dist/vue-class-component.d.ts
file with an interfaceClassComponentHooks
which defines an optionalunmounted()
method. However, in Vue 2 this lifecycle hook is actually calleddestroyed()
(it’s renamed tounmounted()
in Vue 3), and as far as I can tell, vue-class-component has no special code to translate between the two names. In this jsfiddle, only thedestroyed()
method is called.