vue-keep-scroll-position
vue-keep-scroll-position copied to clipboard
`inserted()` hook not called when using `<keep-alive>`
Hi,
Thank you very much for this package.
I tried to use the v-keep-scroll-position directive with Nuxt 2.15.8 / Vue 2.6.14, but it didn't work.
It correctly saves the scroll position in the attribute, but it never restores it because the inserted() hook is not called.
Since I'm using keep-alive, I'm assuming that Vue doesn't treat the component as a new one and, therefore, doesn't call inserted().
To work around this issue, I restore the scroll position from the componentUpdated() hook, and it works perfectly.
I don't know if this change can have unwanted implications, but it sure made the directive work.
Best regards, Benoit