@kaokei/use-vue-service
Version:
Lightweight Vue 3 state management with dependency injection, inspired by Angular services.
25 lines (17 loc) • 1.66 kB
Markdown
<h1 align="center">npm install @kaokei/use-vue-service</h1>
<div align="center">
[](https://github.com/kaokei/use-vue-service/actions/workflows/build.yml)
[](https://coveralls.io/github/kaokei/use-vue-service?branch=main)
[](https://npmcharts.com/compare/@kaokei/use-vue-service?minimal=true)
[](https://www.npmjs.com/package/@kaokei/use-vue-service)
[](https://www.npmjs.com/package/@kaokei/use-vue-service)

</div>
灵感来自 angular 中的服务的概念。在 angular 中不需要全局唯一的数据源 store。而是通过声明服务,以及向组件中注入服务来达到数据管理以及数据共享的。
本库也是实现了类似的效果,可以通过依赖注入实现面向服务编程、实现领域驱动开发。从而可以代替 vuex/pinia。
本库通过类来声明服务,对 typescript 支持非常棒。
- [入门指南](./docs/guide/README.md)
- [API 文档](./docs/api/README.md)
- [博客文章](./docs/note/01.父组件与子组件的理解.md)
- [codesandbox example](https://codesandbox.io/s/di-playground-zjnyv)
- [online demo](https://use-vue-service.vercel.app/)