The API cannot be requested after the project built by vue-cli refreshes the page.

before refresh

main.js

Apr.24,2022

Don't you find an extra undefined? take a look at the problem written in the api you requested


The

interface address has changed to http://localhost:8080/undefined. There is something wrong with the spelling of this interface. In fact, you can do this. Create a new public js directory, and then create a new api.config.js. The content of this js file is:

//
const host = 'http://192.168.163.177:8080';
//
const host = 'http://192.168.163.177:8080';

export default host;

just use which comment, and then in main.js , introduce the js file.
such as import api from'. / api.config.js' and then Vue.prototype.api = api . Finally, this.api can be used in each component without making any judgment.

Menu