兩個方法都是傳值給vuex的mutation改變state
dispatch:異步操作,數據提交至 actions ,可用於向后台提交數據
this.$store.dispatch('isLogin', true);
commit: 同步操作,數據提交至 mutations ,可用於登錄成功后讀取用戶信息寫到緩存里
this.$store.commit('loginStatus', 1);
注:必須要用commit(‘SET_TOKEN’, tokenV)調用mutations里的方法,才能在store存儲成功。