Vue 在vuex 的store中调用axios方法不成功

import axios from 'axios'
Vue.prototype.$http = axios;
actions: {    // 获取未读消息
    GetunderMessage({ commit }, loginToken) {   
       const formData = new FormData();
      formData.append('token', loginToken);
      formData.append('app', '0');    
        console.log(formData);    
          this.$http.post('http://192.168.16.221:8090/member_api/unreadMessage', formData).then(response => {   
               var res = response.data.data;     
               console.log(res);
        commit('SET_unreadMessage', res.length);
      }).catch(error => {        
          console.log(error);
      });
    }
  }

提示: Cannot read property 'post' of undefined


慕码人8056858
浏览 2678回答 2
2回答

MMMHUHU

this.$http实在app.vue里挂载的axios,在这里你要用axios
打开App,查看更多内容
随时随地看视频慕课网APP