# vue-service-state

> 基于vue的响应式状态管理插件

Latest version **1.0.32** (published 2019-11-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-service-state
pnpm add vue-service-state
yarn add vue-service-state
bun add vue-service-state
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.32 |
| Published | 2019-11-17 |
| First published | 2019-11-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | TQi |
| Maintainers | tcweidao |
| Keywords | vuex, vuex-ts, vuex-ts-class, vue-service, vuex-class, vue-service-ts |

## Links

- npm: https://www.npmjs.com/package/vue-service-state
- npm.io page: https://npm.io/package/vue-service-state

## Recent versions

- 1.0.32 (latest) — 2019-11-17
- 1.0.31 — 2019-11-17
- 1.0.3 — 2019-11-17
- 1.0.2 — 2019-11-17
- 1.0.1 — 2019-11-12
- 1.0.0 — 2019-11-11

## README

>### 简介：
 * vuex-service-state 是对基于Vue的一个状态管理插件、降低来代码的耦合度
 * 通过装饰器来注入State 或者 Action
            
>### 使用:
`yarn add vuex-service-state`

```typescript
//service/index.ts
import {Service, Action, ServiceAction, ServiceState} from "vue-service-state";

new Service();

//用来储存状态
@ServiceState
class User {
    public name: any = 100;
}

//用来标示一个action组件
@ServiceAction
class UserAction extends Action{
    public setName(): void {
        this.commit("User.name", 200);
    }
}

//Test.vue
import {Component, Vue} from "vue-property-decorator";
import {AutoWriteState, AutoWriteAction} from "vue-service-state";

@Component
export default class TestService extends Vue {
    //这里的属性名称必须和Service里面定义State的类名称保持一致
    @AutoWriteState
    public User: any;

    //这里的属性名称必须和Service里面定义Action的类名称保持一致
    @AutoWriteAction
    public UserAction: any;

    public update() {
        this.UserAction.setName();
    }

}
```

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