How to set the root domain name by reading the configuration file for the project packaged by vue

whether a vue project can set the root domain name of the provider by reading web.config or config.json after packaging.
in this way, even if the root domain name is redeployed in the background, the front end of the root domain name does not have to be packaged again. You only need to change the configuration file to ok

.
Feb.28,2021

index.html

window.config = {
    Host: '..........'
}

main.js
window.config.Host + 

configure a global constant

in main.js

const baseUrl = 'your domain name'
then access the interface baseUrl +'/ xxx/xxx'


1 establish the root domain name of config.json, configuration under the static folder static,
2 introduce: var URL = require ('. / static/config.json') into main.js;
this file (dist/static/config.json) will be found in the static folder under the dist folder after packaging. If you want to modify the root domain name later, just modify the config.json on the server

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be8c15-31932.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be8c15-31932.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?