Page change event #8950
Unanswered
hazer-hazer
asked this question in
Questions (Nuxt 2)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, i'm making localization system. (I'm not using
nuxt-i18n
, 'cause I need something more complex and need more control)Storing cache in
localStorage
and sending request to the server if some info not exists.I've spend much time trying to solve the problem with "page changed event". In case of SPA I cannot rely on
window.onload
of course, alsowatch
for$route
does not always work too.I've a loader that's waiting for
l10n
data to load and sometimes it's just infinite. The problem in the "sometimes" 😞.Can someone recomend me, please, way to check for page change for sure?
Some notes about structure:
component
/page
, that needs localization, hasthis.$l10n.page(this)
orthis.$l10n.component(this)
increate
function (maybe bad design to passthis
) but it simplifies everything$l10n
plugin collectscomponent's
/page's
l10n
fields to load if something not found in cache (inlocalStorage
)default
layout I've gotthis.$l10n.load()
insidewatch {$route}
ormounted
(the problem is here -- none of them always work)$l10n.load()
loadsl10n
data from server and setsl10n
fields in components that are registered beforeBeta Was this translation helpful? Give feedback.
All reactions