Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xujif/vue-immer-store
A vue plugin that uses immer-js as vue's state manager, redo/undo is supported.
https://github.com/xujif/vue-immer-store
Last synced: 17 days ago
JSON representation
A vue plugin that uses immer-js as vue's state manager, redo/undo is supported.
- Host: GitHub
- URL: https://github.com/xujif/vue-immer-store
- Owner: xujif
- License: mit
- Created: 2022-07-19T14:43:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-18T02:32:09.000Z (over 2 years ago)
- Last Synced: 2024-10-14T09:17:53.204Z (2 months ago)
- Language: TypeScript
- Size: 61.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-immer-store
A vue plugin that uses immer-js as vue's state manager, redo/undo is supported.### Usage
#### Install
```bash
npm i --save-dev vue-immer-store
```#### API
```typescript
import { useImmer } from 'vue-immer-store'const { state, redo, undo, canRedo, canUndo } = useImmer({ count: 1 })
// update draft state directly
produce(r => {
r.count = 1
})// update by return value, primitive is supported
produce(() => {
return {
count: 2,
}
})/* template
{{state.count}}*/
```