axios
pm install axios --save
2.在vue文件中引入,import Axios from 'axios'
3.使用,Axios.get(url).then((res)=>{}).catch((err)=>{})
<template><div id="app"><div v-html="htmlValue"></div></div></template><script>import Axios from "axios";export default {name: "app",data() {return {flag: true,htmlValue: ""};},methods: {getData() {Axios.post(`/api/auth/login`).then(res => {console.log(res)this.htmlValue=res.data}).catch(err => {});}},mounted() {this.getData();}};</script><style lang="scss"></style>
如果觉得《Vue axios发送Http请求》对你有帮助,请点赞、收藏,并留下你的观点哦!