# pinia-facing-decorator

> pinia装饰器模块

Latest version **0.1.0** (published 2024-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install pinia-facing-decorator
pnpm add pinia-facing-decorator
yarn add pinia-facing-decorator
bun add pinia-facing-decorator
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2024-01-09 |
| First published | 2024-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | maxiaoqu |
| Maintainers | maxiaoqu |
| Keywords | pinia-facing-decorator, pinia-decorator, pinia, decorator, vue3 pinia, vue3 pinia, vue-facing-decorator |

## Links

- npm: https://www.npmjs.com/package/pinia-facing-decorator
- Repository: https://github.com/AmA-Utlis/pinia-facing-decorator
- Homepage: http://www.maxiaoqu.com
- Issues: https://github.com/AmA-Utlis/pinia-facing-decorator/issues
- npm.io page: https://npm.io/package/pinia-facing-decorator

## Dependencies (1)

- [pinia](https://npm.io/package/pinia.md) ^2.1.7

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2024-01-09

## README

# pinia 装饰器模块

使用装饰器来编写你的pinia，配合[vue-facing-decorator（npm）](https://www.npmjs.com/package/vue-facing-decorator)、[vue-facing-decorator（github）](https://github.com/facing-dev/vue-facing-decorator)
使用效果更加！

## 项目简介

- 使用技术：pinia
- 参考项目：vuex-module-decorators

## 安装

```
npm install pinia-facing-decorator
```

## 使用

### 代码

```
import {PiniaModule, Module, Plugins, Actions} from "@/pinia-facing-decorator";

@Module("test")
export default class Test extends PiniaModule {
  name: string = "name";
  age: number = 23;

  get getName() {
    return this.name;
  };

  get getAge() {
    return this.age;
  };

  @Actions
  setName(name: string) {
    this.name = name;
  }

  @Actions
  setSystemConfig(age: number) {
    this.age = age;
  }
  
  @Actions
  addAge(age: number) {
    this.age = age;
  }
  
  @Plugins
  debounce = {
     addAge: 3,
  }
}
```

就像

```
import {defineStore} from "pinia";

const testUserStore = defineStore("user", {
  state: () => {
    return {
      name: "name",
      age: 23
    };
  },
  getters: {
    getName: (state) => state.name,
    getAge: (state) => state.age
  },
  actions: {
    setName(name: string) {
      this.name = name;
    },
    setAge(age: number) {
      this.age = age;
    },
    addAge(age: number) {
      this.age = age;
    }
  },
  debounce: {
    addAge: 3,
  }
});

export default testUserStore;
```

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