vuex的两种写法

  • Post author:
  • Post category:vue



第一种:


actions.js


getters.js


index.js


mutations.js


state.js


官网文档普遍使用这种,刚上使用这种


第二种:


action.js


getters.js


index.js


mutation-types.js


mutations.js


这种在mutation-types.js中定义好mutations.js的方法名,方便管理,state.js的状态就定义在index.js了。推荐这样



版权声明:本文为bbsyi原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。