vue-electron/vuex-electron
关于
Vuex 与 Electron 的集成
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
Vuex Electron
The easiest way to share your Vuex Store between all processes (including main).
Features
:star: Persisted state
:star: Shared mutations
Requirements
Installation
Installation of the Vuex Electron easy as 1-2-3.
Install package with using of yarn or npm:
yarn add vuex-electronor
npm install vuex-electronInclude plugins in your Vuex store::
import Vue from "vue" import Vuex from "vuex" import { createPersistedState, createSharedMutations } from "vuex-electron" Vue.use(Vuex) export default new Vuex.Store({ // ... plugins: [ createPersistedState(), createSharedMutations() ], // ... })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):import './path/to/your/store'Well done you did it! The last step is to add the star to this repo :smile:
Usage example: Vuex Electron Example
IMPORTANT
In renderer process to call actions you need to use dispatch or mapActions. Don't use commit because actions fired via commit will not be shared between processes.
Options
Available options for createPersistedState()
createPersistedState({
whitelist: ["whitelistedMutation", "anotherWhitelistedMutation"],
// or
whitelist: (mutation) => {
return true
},
// or
blacklist: ["ignoredMutation", "anotherIgnoredMutation"],
// or
blacklist: (mutation) => {
return true
}
})
Author
Andrew Emelianenko
IG: @truemelianenko
License
探索相关项目
加载中…