vueaxios配置解析
程序员文章站
2022-09-21 23:06:26
vue axios配置
//main.js import axios from "axios"; vue.prototype.$axios = axios; //使用: //ge...
vue axios配置
//main.js import axios from "axios"; vue.prototype.$axios = axios; //使用: //get请求: this.$axios .get("apis/query", { params: { //参数 type: "yuantong", postid: "111111111" } }) .then(res => { console.log(res.data); }) .catch(error => { console.log(error); }); //post请求: //qs是第三方库,用来处理post参数 import qs from "qs"; this.$axios .post( "apis/query", qs.stringify({ type: "yuantong", postid: "111111111" }) ) .then(res => { console.log(res.data); }) .catch(error => { console.log(error); });上一篇: 担心红米旗舰配置低?雷军:绝对过虑了
下一篇: 刘兵:云计算宜精不宜滥