Vue-cli packages different environments according to different commands

first of all, let"s explain that Xiaobai has just come into contact with the vue-cli configuration project
my needs are as follows: different domain names can be packaged according to different command lines, that is, the corresponding domain name environment, but I found a lot of them on the Internet, but they can"t achieve my results. For example: https://juejin.im/post/5abef4.
, but it seems that the above can only package the interface domain name. My requirement is that all domain names should be changed. When I configure build according to the above tutorial, what I show here is not the expected result. I don"t know if there is something wrong with my configuration. Please take a look at my elder brother and thank you.


you can change the configuration. Change the domain name into variables and assign values to the environment that needs to be packaged. In this way, you can achieve the effect you said


what do you mean all domain names should be changed? Normally, you only need to configure the interface domain name. The domain name you visit will change if you put it in the corresponding server directory. This does not need to be changed.


I usually encapsulate axios, and write baseUrl in the encapsulated ajax function. When I go online, I change it to an online address


it is suggested to build a special api directory to encapsulate variables and interfaces, and then axios encapsulates request

.
Menu