onlystate

v0.0.13
A state and only state management library for Vue3
vue3 state state management shared state

onlystate

一个仅关注state的状态库, 基于vue3-reactive模块实现, 并且提供vue-devtools插件

特点

  • 关注于State,去掉了action,你可以通过compositionAPI来时实现action

使用

npm install onlystate --save-dev

  1. 定义state
//store.js
import {defineState} from 'onlystate';
const install = defineState({
    a: 1,
    b: 2
}, {
    c: state => 'a=' + state.a,
    d: state => 'b=' + state.b
});
export default install;
  1. 注册state
import Astate from './store'
//main.js
app = createApp(App);
app.use(Astate);
  1. 基本使用
<script setup>
import {useState} from 'onlystate';
    const [a, b] = useState('a', 'b');
    a.value = 2;
</script>

TODO

  • 基本功能
  • rollup打包umd、cjs、esm
  • vue devtools 文件单独打包使用
npm i onlystate

Metadata

  • MIT
  • Whatever
  • webszy
  • released 5/13/2022

Downloads

Maintainers