At present, because the front-end deployment of the company is deployed without a network, we package the Vue project into a dist package, and configure the external request address or the request address of other relevant parties on site. In order to solve this problem, so record the solution
-
Create a static folder under public and create config.js
-
config.js sets the variables we need, remember to set the windows variables, do not set the scope
-
We know that vue is a single-page application, and config.js is introduced under the public index.html.
<script src="<%= BASE_URL %>static/config.js"></script>
4. Directly use the static position under 5.dist where needed