get请求
let url = ""; this.$axios({ url: url, method: "get", params: { a: 1, b: 2 }, }).then((res) => { console.log(res); }).catch(function(error) { // this.$message.error(error); });
post请求
var url = ""; this.$axios({ url: url, data: { a: 1 }, headers: {'Content-Type': 'application/json'}, method: "post", }).then((res) => { console.log(res); });
以上代码是拿来复制粘贴用的,仅用来做笔记