Update Store

master
yutent 2023-09-26 10:05:17 +08:00
parent d3be9d1be2
commit 33b956c42b
1 changed files with 23 additions and 1 deletions

@ -1 +1,23 @@
Welcome to the Wiki.
# 状态管理
> 这是一个比较简单的状态管理库, 不支持复杂的逻辑。使用也比较简单。
```js
import { createStore } from 'wkitd'
const store = createStore({
foo: 123,
bar: {
goo: 6666
}
})
app.use(store)
```
在任意`wkit`组件内, 都可以通过`this.$store`访问到该对象, 修改store中的任意属性, 均会同步更新到各个组件的视图。
在非`wkit`组件中, 可以使用`getStore()`获取到store对象。