1、安装引入axios
和vue-axios
npm install axios npm install vue-axios
2、在main.js
中导入并全局使用axos
和vue-axios
:
import axios from 'axios' import VueAxios from 'vue-axios' Vue.use(VueAxios,axios); Vue.prototype.$axios = axios;
3、使用方法
this.axios({ method: 'get', url: process.env.VUE_APP_BASE_API + "/queryTimeAxisList", params: {} }).then(res => { console.log(res) });