1 download axios installation:
npm install axios --save
2 import to main.js page:
import axios from 'axios'
3. Usage: The method defined function called methods: axios.get ( ' URL address ' ) .then ((RES) => {} operation to be performed
Method 4 mounted in the methods of the periodic function call
5 If there is no api, then fill it in index.js config in the configuration
proxy table: {
'/api': {
target: 'http: // localhost: 8081', // here is not necessarily the port number 8081, possibly 8080
Pthriawrite: {
'^ / Api': '/ static / data' // data to build my own folder name, write your own folder name on the line
}
}
},