简介 VUE项目中,将数据存储到VUEX中时,分为两种方式: commit和dispatch。 具体实现 方式一: commit:同步操作,调用的是mutations里的方法 (1)存储: this.$store.commit("属性名", "值"); // example this.$store.commit("usernam