美文网首页
vue 使用axios

vue 使用axios

作者: Hello杨先生 | 来源:发表于2019-10-31 12:25 被阅读0次
npm install axios --save

// 引入axios,并加到原型链中
import Axios from 'axios'
Axios.defaults.withCredentials=true;
Axios.defaults.baseURL='http://url'
Vue.prototype.$http = Axios



created() {
    //var openId = localStorage.getItem("openId");
    this.$http
      .get("/app/login/autoLogin?openId="+openId)
      .then(res => {
        console.log(res.data);
        this.myDetail = res.data;
      });
  },

相关文章

网友评论

      本文标题:vue 使用axios

      本文链接:https://www.haomeiwen.com/subject/mnazvctx.html