# vuex-class

> Binding helpers for Vuex and vue-class-component

Latest version **0.3.2** (published 2019-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install vuex-class
pnpm add vuex-class
yarn add vuex-class
bun add vuex-class
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2019-03-15 |
| First published | 2017-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1705 |
| Author | katashin |
| Maintainers | ktsn |
| Keywords | vue, vuex, bindings |

## Links

- npm: https://www.npmjs.com/package/vuex-class
- Repository: https://github.com/ktsn/vuex-class
- Issues: https://github.com/ktsn/vuex-class/issues
- npm.io page: https://npm.io/package/vuex-class

## Recent versions

- 0.3.2 (latest) — 2019-03-15
- 0.3.1 — 2018-05-09
- 0.3.0 — 2017-10-18
- 0.2.0 — 2017-04-29
- 0.1.3 — 2017-01-20
- 0.1.2 — 2017-01-20
- 0.1.1 — 2017-01-14
- 0.1.0 — 2017-01-14

## README

# vuex-class

[![vuex-class Dev Token](https://badge.devtoken.rocks/vuex-class)](https://devtoken.rocks/package/vuex-class)

Binding helpers for Vuex and vue-class-component

## Dependencies

- [Vue](https://github.com/vuejs/vue)
- [Vuex](https://github.com/vuejs/vuex)
- [vue-class-component](https://github.com/vuejs/vue-class-component)

## Installation

```bash
$ npm install --save vuex-class
# or
$ yarn add vuex-class
```

## Example

```js
import Vue from 'vue'
import Component from 'vue-class-component'
import {
  State,
  Getter,
  Action,
  Mutation,
  namespace
} from 'vuex-class'

const someModule = namespace('path/to/module')

@Component
export class MyComp extends Vue {
  @State('foo') stateFoo
  @State(state => state.bar) stateBar
  @Getter('foo') getterFoo
  @Action('foo') actionFoo
  @Mutation('foo') mutationFoo
  @someModule.Getter('foo') moduleGetterFoo

  // If the argument is omitted, use the property name
  // for each state/getter/action/mutation type
  @State foo
  @Getter bar
  @Action baz
  @Mutation qux

  created () {
    this.stateFoo // -> store.state.foo
    this.stateBar // -> store.state.bar
    this.getterFoo // -> store.getters.foo
    this.actionFoo({ value: true }) // -> store.dispatch('foo', { value: true })
    this.mutationFoo({ value: true }) // -> store.commit('foo', { value: true })
    this.moduleGetterFoo // -> store.getters['path/to/module/foo']
  }
}
```

## Issue Reporting Guideline

### Questions

For general usage question which is not related to vuex-class should be posted to [StackOverflow](https://stackoverflow.com/) or other Q&A forum. Such questions will be closed without an answer.

### Bug Reports

Please make sure to provide minimal and self-contained reproduction when you report a bug. Otherwise the issue will be closed immediately.

## License

MIT

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