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