dispatch ,commit区别在vue store

2019-11-11 16:43:43

dispatch: 含有异步操作,commit:同步操作

dispatch: 含有异步操作

存储:

this.$store.dispatch('initUserInfo',friend);

取值:

this.$store.getters.userInfo;

commit:同步操作

存储:

this.$store.commit('initUserInfo',friend);

取值:

this.$store.state.userInfo;
  • 2020-12-21 14:00:19

    iframe + postMessage跨域通信

    在实际项目开发中可能会碰到在 a.com 页面中嵌套 b.com 页面,这时第一反应是使用 iframe,但是产品又提出在 a.com 中操作,b.com 中进行显示,或者相反。

  • 2020-12-22 12:02:41

    ios开发优秀的开源框架,demo集合

    期待大家和我们一起共同维护,同时也期望大家随时能提出宝贵的意见(直接提交issues即可)。请广大网友只按照目录结构(即使目录结构有问题)添加三方库,并提交pull request。目录问题大家提出issues后楼主会及时更改的。