Open mofada opened 2 years ago
我遇到类似的问题
我遇到类似的问题
后来解决了吗?
@Seb-L, any update? Is it possible to revert back?
@Seb-L, any update? Is it possible to revert back?
I try to use localStorage alone for storage and it works fine
Temporary workaround, the works fine
I had to revert back to the older version. It works there.
I am also facing the same issue, Pinia State is changing but not saving in localStorage Is There any way So that I can force to update pinia-plugin-persist to save current state?
I guess, maybe you are using the store in pinia in other ts or js files, because of this, the state in the store is no longer responsive, in other words, pinia will not be hijacked again, at this time, it needs to be handled manually.
I used vue-i18n in the project and my code is as follows,code directory is src/i18n/index.ts
import {createI18n} from 'vue-i18n'
import ZH from "@/i18n/lang/zh"
import EN from "@/i18n/lang/en"
import localStore from 'store2'
const messages = {
en: {
message: {
...EN
}
},
zh: {
message: {
...ZH
}
}
}
const i18n = createI18n({
legacy: false, // 使用 Composition API
globalInjection: true, // 全局使用 t 函数
locale: localStore.get('language') === null ? 'zh' : (localStore.get('language').hasOwnProperty('language') ? localStore.get('language').language : 'zh'),
messages
})
export default i18n
中文翻译: 我在项目中使用了 vue-i18n,我的代码如下,目录是 src/i18n/index.ts
import {createI18n} from 'vue-i18n'
import ZH from "@/i18n/lang/zh"
import EN from "@/i18n/lang/en"
import localStore from 'store2'
const messages = {
en: {
message: {
...EN
}
},
zh: {
message: {
...ZH
}
}
}
const i18n = createI18n({
legacy: false, // 使用 Composition API
globalInjection: true, // 全局使用 t 函数
locale: localStore.get('language') === null ? 'zh' : (localStore.get('language').hasOwnProperty('language') ? localStore.get('language').language : 'zh'),
messages
})
export default i18n
这个问题如何解决呢?
这个问题如何解决呢?
手动处理啊,
@Aurorxa 大佬你说的很对,但是我没看懂你的这句话,我有一段代码在 store 挂载之前使用了里面的 state,然后就导致了 插件不再缓存,删掉后就正常了
@Aurorxa 大佬你说的很对,但是我没看懂你的这句话,我有一段代码在 store 挂载之前使用了里面的 state,然后就导致了 插件不再缓存,删掉后就正常了
我也是萌新啊,我只是猜测应该这么做的,具体源码我也没有分析,哈哈~
Is there a plan to fix this any time soon please?
tip: However, directly enter the login (http://localhost:3000/login), enter the email address and name, click login, and enter the home page. At this time, clicking refresh will not lose user information.
you can find code in the here pinia-plugin-persist-bug-recurrent
https://user-images.githubusercontent.com/22286246/175505542-12654c5b-ae1e-4473-b4aa-cc7305015c6d.mp4