在基于electron
开发时使用vuex
的dispatch
方法传值无效
|
|
并且不报任何错误.经查找是vuex-electron
的问题.
解决方法1:
在store/index.js
中去掉createSharedMutations
|
|
这是因为 vuex-electron
引入了一个用于多进程间共享 Vuex Store 的状态的插件.如果没有多进程交互的需求,完全可以不引入这个插件.
解决方法2
https://github.com/vue-electron/vuex-electron#installation
看第 3 条:
In case if you enabled
createSharedMutations()
plugin you need to create an instance of store in the main process. To do it just add this line into your main process (for examplesrc/main.js
):
12 > import './path/to/your/store'>
这种时候就不能用第一种方法来解决问题了。
找到 /src/main/index.js
,在前面加上一句:
|
|