当前位置:网站首页>Global variable configuration dev . dev.dev . dev.test
Global variable configuration dev . dev.dev . dev.test
2022-07-21 20:40:00 【Bug tune teacher】
Global variable configuration
Now many front-end projects need to be managed by the back-end , They often change the address of the request interface , But I don't want to ask the front end to change the code every time , So we let the backend operate freely through configuration
First of all : New file
Create a new file name in the project root directory :.env.test
The contents of the document
NODE_ENV = 'test'
VUE_APP_BASE_API = 'https://www.baidu.com/'
notes :NODE_ENV This value does not need a prefix , Other values need to be prefixed VUE_APP_*****
The second step : file package.json Configure packaging commands
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test": "vue-cli-service build --mode test"
},
The third step : Use
Use process.env.VUE_APP_BASE_API That's all right. .
Did you stop learning ?
If you only configure the above , There must be another big problem , See you in the next article
边栏推荐
- [C语言]逃跑吧 跑出这满是烟火味的世俗 C初阶最后战役
- (good pairs) assign the value of one array to another array
- C语言实现三子棋小游戏---格局打开版(
- 今天不拉扯了 不拉扯了 碎碎念 上
- Object. prototype. toString. The principle of call()
- Data analysis of akali teaching Bureau in the first half of the fifth set
- In depth analysis - Data
- Self taught programming for more than 80 years, these private practical tools & learning websites have accompanied me to the present. I must collect them and double my learning efficiency - Website
- 专栏开设的意义
- First Working Day~
猜你喜欢
Object. prototype. toString. The principle of call()
First Working Day~
Acwing 175 circuit maintenance
MySQL account management Database building and four engines
12.【I/O流get()与getline()与put()函数】
Relationship between prototype, prototype chain, constructor and instance
动态监听DOM元素的高度
JS operation mechanism
[C语言]请将细碎的能力函数与数组飞回光之国
MySQL之函数
随机推荐
专栏开设的意义
Acwing 175 circuit maintenance
Don't pull it today, don't pull it, read it in pieces
Data analysis on the fourth match
Deep analysis of string -- StrCmp & strncmp
[C语言] 选择 循环还可以这样玩 代码表白光之国
图片上传
Click the back button to return to the previous page
SimpleDateFormat正确使用
Available parameters are [list]批量上传时错误
[C语言] 0.5倍速讲解世纪大战 有趣的C语言玩法
MySQL functions
CSDN2022总排名前十统计
动态监听DOM元素的高度
Namespace namespace
20.【char*与string相等不相等】
moment自定义时间区间
In the fourth game, where is the restaurant? Shepherd boy points to Xinghua village from afar and matches several to relieve the pressure on the line
C. Binary string (prefix sum)
Dynamically listen for the height of DOM elements