troxler / vue-headful

Set document title and meta tags with Vue.js
MIT License
229 stars 17 forks source link

When edit title on one view, title stays the same for every other pages #15

Closed julesfrn closed 4 years ago

julesfrn commented 4 years ago

Hello, When I use the vue-headful component on one page, if I go to this page and then switch to another page, the title stays the same as the one from the vue-headful component. Is this a normal behaviour ? Is there any way to prevent this ? I would like the title to come back to it's original value (the one I set manualy in the index.html file)

troxler commented 4 years ago

That is by design. vue-headful is intentionally minimalistic. It does not keep any state at all. It just updates the DOM when you tell it to. If you then browse to a different route in an SPA and don't tell it to do anything, it won't do anything. But as you recycle the DOM of the last route in your current route, the title is already set to the one of the last page.

There is nothing in vue-headful that could solve this. It is probably not the right tool for the job here.

julesfrn commented 4 years ago

Hello I realised I never gave the solution I found for my problem. It's a simple trick I just use the regular version of headful (without the vue wrapper) and I call headful on the before create hook with the parameters I want and I just reset headful calling on the before destroy hook with the default parameters