0👍
Pinia store composables are primarily intended to postpone the instantiation of a store and avoid this error, they aren’t supposed to be used at top module level.
Since createI18n
options accept non-reactive locale
string, the usage of the store would make no sense here.
locale
can be changed either from store actions, also may need to be called set initial value:
actions: {
setLang(lang) {
this.lang = lang;
i18n.global.locale = lang;
},
...
Or the values can be synchronized from the outside, can be done inside root component:
const store = useaStore()
watch(
() => store.lang,
() => { i18n.global.locale = store.lang; }
{ immediate: true }
)
- [Vuejs]-Handling errors from an array input field from Laravel with VuejS
- [Vuejs]-Vite build generates different css module classes
Source:stackexchange.com