标签:port his prot promise hat size 16px url 返回
axios作用:Axios 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中。
首先。安装及配置
使用npm安装
npm install axios
使用 yarn 安装
yarn add axios
然后在入口文件 main.js中引入
import axios from ‘axios‘
vue.prototype.$axios = axios
axios POST请求实例
that.$axios.post(url,{a:1,b:2})
.then(function (res) {
console.log("返回值")
})
.catch(function (error) {
console.log(error);
});
axios get请求实例
this.$axios.get(url,{params:{a:1,b:2}})
.then(function (response) {
console.log(‘返回值‘)
})
.catch(function (error) {
// this.$message.error(error);
});
标签:port his prot promise hat size 16px url 返回
原文地址:https://www.cnblogs.com/banyuege/p/12918991.html