How does vue modify the default point of the interface for project packaging?

as mentioned above, the files packaged by the vue project are deployed on the server, and all the request domain name ports are directed to the current server. What I want to ask is, can I change the default API to point to?
I thought about writing a configuration file to be introduced in index.html, which is configured according to the environment, but in this way the domain name port of each environment can only be written dead.
has also thought about getting the content before the current fullurl intercept /-sharp/ before modifying and then spelling it, but it just doesn"t feel good. No, no, no.
guys, is there any flexible way to recommend it?

Mar.14,2021

this needs to be done according to the demand. If you only have three domain names in your backend, what's the problem with writing them? if the requested url needs to be changed according to the current domain name, you can intercept it.


Axios doesn't have a baseURL

const service = axios.create({
  baseURL: process.env.baseURL, // apibaseURL
  timeout: 5000 // 
})

you can judge whether production development or test switching url automatically according to NODE_ENV

module.exports = {
  NODE_ENV: '"production"',
  baseURL:'"xxxxxxxxx"'
}
Menu