Step 1: Install Axios
$ npm install axios
Step 2: Import Axios in main.js
import VueAxios from 'vue-axios';
import axios from 'axios';
Vue.prototype.$axios = axios;
Step 3: Write the Axios request code
created(){
const _this = this
this.$axios.get('http://localhost:8081/book/findall').then(function (resp) {
_this.books = resp.data;
})
Read More:
- Encapsulation of Axios and management of API interface in Vue
- How to solve the cross domain problem of Axios in Vue project
- Flash + Vue uses Axios to obtain server data, and reports error: “request aborted”
- Solution of Vue axios400 bad request problem
- The problem that headers [‘content-type ‘] does not work is set in the Axios get method request interface
- When writing a website, Vue + Flash prompts network error when visiting Vue page
- Vue router click the menu bar and the same module reports an error Vue router.esm.js? 2215:2065 Uncaught (in promise) Error
- Idea installation vue.js After plug-in, new has no Vue component
- When configuring the proxy with Vue, the front-end requests the server-side error 504; the Vue console reports the error occurred while trying to proxy request
- An error is reported when the electron Vue Vue component introduces the electron
- Vue init webpack command error Vue cli / node_ modules/_ [email protected]@rimraf/rimraf.js :313
- Vue element UI uses this. $notify is not a function problem resolution using the notification box
- Vue introduces ecarts, init initializes and reports an error
- Method of getting app. Config. Globalproperties. X directly from vue3
- Vue—— Error: Redirected when going from “/“ to “/directory/tree“ via a navigation guard
- Vue start error: listen eadrnotavail
- Syntax error in Vue ie10 browser
- Flicker problem of Vue
- Solution of “serve with message ‘spawn Vue cli service enoent”
- Vue element admin configure global styles