In IE9 and IE10, the life cycle functions are never called if I use the decorator. If I export an object, it works just fine.
Class (not working): https://github.com/pcmulder/ts-vue-class-component
Object (working): https://github.com/pcmulder/ts-vue-class-component/tree/object
Is there anything I'm missing or not getting?
Thanks for reporting this.
This is because IE9 and 10 does not have __proto__, then the component constructor has Vue's static properties as its own property in TypeScript. This causes unintended overwrite of components options object that includes lifecycle hooks.
Meanwhile you can use v6.0.0. this should not happen on that version.
I am experiencing the same here with chrome.
Simply put, the reason for this is
while vue-router will extract these guards directly from the def.options object
What would be the best solution now. Register the guards on def.options or on def.options.methods? Is there even a global beforeRoute*? When not, registering these hooks on def.options should make more sense instead of registering them with def.options.methods, as the latter is actually not supported by vue-router.
As a side node, when using babel everything works just fine. Wondering why, though.
I saw your reproduction in vue-router issue. The reason is you are registering the hooks after declaring component. As stated in readme you have to register it before component declaration.
@ktsn hmpf, may I be so stupid? next try...
@ktsn while your are correct in that the order by which the components are loaded and the respective hooks are registered is incorrect, even when reorganising the sources, it still fails.
Then could you open a new issue with the code? It probably be different issue with this issue.
@ktsn will do
Most helpful comment
Meanwhile you can use v6.0.0. this should not happen on that version.