我们把上面代码中的mutations单独提取出来,放到mutations.js中: 这个常量是什么意思呢?我们再新建一个mutations-type.js 再把actions也抽取出来: 这里再用常量ADD替换一下: