当前位置:网站首页>基地址:环境变量
基地址:环境变量
2022-08-04 03:01:00 【这次我一定要赢】
一.作用
环境变量:为不同环境设置不同变量
二.开发环境
development
流程:
1.根目录创建一个文件.env.development
2.在文件中设置相应环境的变量
接口基地址;VUE_APP_开头
VUE_APP_URL='开发环境接口基地址'
三.生产环境
production
1.根目录创建一个文件.env.production
2.在文件中设置相应环境的变量
接口基地址;VUE_APP_开头
VUE_APP_URL='生产环境接口基地址'
四.使用
process.env.VUE_APP_URL可以拿到定义的值
npm run server 开发:process.env.VUE_APP_URL===aaa
npm run build 生产:process.env.VUE_APP_URL===bbb
五.实际应用


开发环境下:

我们来看一下是否能够识别到:

可以识别到。
这样我们就可以在生产和开发环境中确定下来一个基地址了。
边栏推荐
- LeetCode每日一题(2285. Maximum Total Importance of Roads)
- 三分建设,七分管理!产品、系统、组织三管齐下节能降耗
- SQL注入中 #、 --+、 --%20、 %23是什么意思?
- In a more general sense, calculating the displacement distance and assumptions
- [Study Notes Dish Dog Learning C] Dynamic Memory Management
- What is the source of flinkcdc consuming mysql binlog data without sqltype=delete
- (cf)Codeforces Round #811 (Div. 3)A--E详细题解
- 一个属于程序员的七夕节!
- 2022广东省安全员A证第三批(主要负责人)考试题库及模拟考试
- There are too many systems, how to realize multi-account interworking?
猜你喜欢

Pine脚本 | 如何显示和排版绘图开关?

Architecture of the actual combat camp module three operations

LeetCode每日一题(2285. Maximum Total Importance of Roads)

关联接口测试

【学习笔记之菜Dog学C】动态内存管理

C language -- ring buffer

小程序:扫码打开参数解析

Ant - the design of the Select component using a custom icon (suffixIcon attribute) suffixes, click on the custom ICONS have no reaction, will not display the drop-down menu
![[Playwright Test Tutorial] 5 minutes to get started](/img/68/36dd8ef4a4073f03d5e5dad91be20d.png)
[Playwright Test Tutorial] 5 minutes to get started

There are n steps in total, and you can go up to 1 or 2 steps each time. How many ways are there?
随机推荐
C language -- ring buffer
多线程间的通信方式你知道几种?
C# 构造函数业务场景测试项目
Brush esp8266-01 s firmware steps
In a more general sense, calculating the displacement distance and assumptions
数据安全峰会2022 | 美创DSM获颁“数据安全产品能力验证计划”评测证书
织梦响应式酒店民宿住宿类网站织梦模板(自适应手机端)
一文看懂推荐系统:召回04:离散特征处理,one-hot编码和embedding特征嵌入
Returns the maximum number of palindromes in a string
2022年最新海南建筑八大员(材料员)模拟考试试题及答案
安装postgis时报找不到“POSTGIS_VERSION”这个函数
MySQL高级-读写分离-分库分表
Why use Selenium for automated testing
unsafe.Pointer, pointer, reference in golang
activiti流程执行过程中,数据库表的使用关系
三分建设,七分管理!产品、系统、组织三管齐下节能降耗
uni-app 从零开始-基础模版(一)
一文看懂推荐系统:召回05:矩阵补充、最近邻查找,工业界基本不用了,但是有助于理解双塔模型
KingbaseES数据库启动失败,报“内存段超过可用内存”
Pine Script | How to display and typeset a plot switch?