electron-store

electron + vuecli 搭建的项目 ,使用window.localStorage, 杀掉应用再打开,会清空, 记录用户登录信息有什么好办法? 使用electron-store Uncaught Error: Electron Store: You need to call .initRenderer() from the main process. 求解答

阅读 5.2k
2 个回答

electron-store initrenderer

Initializer to set up the required ipc communication channels for the module when a Store instance is not created in the main process and you are creating a Store instance in the Electron renderer process only.

简单来说数据是在 main process 进行存储,在 renderer process 的使用都是通过 ipc 通信控制 main process 的操作,所以需要想在 main process 执行 initRenderer 进行初始化。

在主线程加下面代码:

import Store  from 'electron-store';
Store.initRenderer()
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏