# vuex-connector-tools

> connector for vuex

Latest version **0.0.6** (published 2019-04-19) · 0 weekly downloads

## Install

```sh
npm install vuex-connector-tools
pnpm add vuex-connector-tools
yarn add vuex-connector-tools
bun add vuex-connector-tools
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2019-04-19 |
| First published | 2019-04-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 174.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | 崔 |
| Maintainers | effectivecui |
| Keywords | vuex, connect, vuex-connector |

## Links

- npm: https://www.npmjs.com/package/vuex-connector-tools
- Issues: https://github.com/effectivecui
- npm.io page: https://npm.io/package/vuex-connector-tools

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^2.6.10
- [vuex](https://npm.io/package/vuex.md) ^3.1.0
- [core-js](https://npm.io/package/core-js.md) ^2.6.5

## Recent versions

- 0.0.6 (latest) — 2019-04-19
- 0.0.5 — 2019-04-19
- 0.0.4 — 2019-04-18
- 0.0.3 — 2019-04-18
- 0.0.2 — 2019-04-18
- 0.0.1 — 2019-04-18

## README

#### User Guide
```
import VuexConnector from 'vuex-connector-tools';
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

//you should write this in your stores directory for best practice
//这只是个示例，如果在生产环境中，应该写到store文件夹下
const store = new Vuex.Store({
    modules: {
         moduleA: {
              namespaced: true,
              state: {},
              getters: {},
              mutations: {},
              actions: {}
         },
         moduleB,
         moduleC
    }
});

//you can write this in a seperate js file and export it
//你可以把这个写到一个单独的文件里面，然后export
const connector = new VuexConnector(store)


//you should write this in your containers directory for best practice
//这只是个示例，如果在生产环境中，应该写到containers文件夹下
const HelloContainer = connector.connect("moduleA", {
    mapStateToProps: ({moduleState, props, rootState})=>{
         return {
             ...moduleState,
             someProp: rootState.moduleB.someProp
         }
    },
    mapGettersToProps: ({moduleGetters, rootGetters, props})=>{
         return {
             ...moduleGetters,
             someGetter: xx
         }
    },
    mapMutationsToProps: ({moduleMutations, moduleState, props, rootState})=>{
         return {
             ...moduleMutaions,
             someMutaionFunctionName: "moduleB/someMutaionFunctionName"//moduleName/functionName, read vuex namespace for more details
         }
    },
    mapActionsToProps: ({moduleActions, , moduleState, props, rootState})=>{
         return {
             ...moduleActions,
             someActionFunctionName: "moduleB/someActionFunctionName"//moduleName/functionName, read vuex namespace for more details
         }
    }
})(HelloWorldComponent);


//then use HelloContainer just as you like,for example
//main.js
new Vue({
    el: '#root',
    store,
    render: h => h(HelloContainer)
});
```

---
_Source: https://npm.io/package/vuex-connector-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
