Update Store

master
yutent 2023-11-15 20:15:34 +08:00
parent e19dfc5c58
commit fcc89b165b
1 changed files with 19 additions and 1 deletions

@ -21,3 +21,21 @@ app.use(store)
在任意`wkit`组件内, 都可以通过`this.$store`访问到该对象, 修改store中的任意属性, 均会同步更新到各个组件的视图。
在非`wkit`组件中, 可以使用`getStore()`获取到store对象。
```js
class Foo extends Component {
mounted() {
watch('$store.foo', val => {
// todo...
})
}
}
```