当前位置:网站首页>基地址:环境变量
基地址:环境变量
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
五.实际应用


开发环境下:

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

可以识别到。
这样我们就可以在生产和开发环境中确定下来一个基地址了。
边栏推荐
- 自制蓝牙手机app控制stm8/stm32/C51板载LED
- docker+网桥+redis主从+哨兵模式
- cdh6.x 集成spark-sql
- Architecture of the actual combat camp module three operations
- 移动端响应式适配的方法
- 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
- Pine Script | How to display and typeset a plot switch?
- Presto中broadcast join和partition join执行计划的处理过程
- MySQL高级-读写分离-分库分表
- MallBook 助力SKT思珂特教育集团,立足变化,拥抱敏捷交易
猜你喜欢

Rongyun "Audio and Video Architecture Practice" technical session [complete PPT included]

Development of Taurus. MVC WebAPI introductory tutorial 1: download environment configuration and operation framework (including series directory).

Example 039: Inserting elements into an ordered list

Countdown to 2 days, the "New Infrastructure of Cultural Digital Strategy and Ecological Construction of Cultural Art Chain" will kick off soon

出海季,互联网出海锦囊之本地化
编写 BOLL 心得体会

Mini program + new retail, play the new way of playing in the industry!

【观察】超聚变:首提“算网九阶”评估模型,共建开放繁荣的算力网络

In the season of going overseas, the localization of Internet tips for going overseas

数据安全峰会2022 | 美创DSM获颁“数据安全产品能力验证计划”评测证书
随机推荐
说说数据治理中常见的20个问题
[Original] Start the XPS/OXPS reader that comes with Windows 10
STM8S-----选项字节
STM8S105K4T6------Serial port sending and receiving
参加Oracle OCP和MySQL OCP考试的学员怎样在VUE预约考试
[Study Notes Dish Dog Learning C] Dynamic Memory Management
Good bosses, please ask the flink CDC oracle to Doris, found that the CPU is unusual, a run down
uni-app 从零开始-基础模版(一)
MallBook 助力SKT思珂特教育集团,立足变化,拥抱敏捷交易
共n级台阶,每次可以上1级或2级台阶,有多少种上法?
Utilities of Ruineng Micrometer Chip RN2026
unsafe.Pointer, pointer, reference in golang
云开发旅游打卡广场微信小程序源码(含视频教程)
How many ways do you know about communication between multiple threads?
FPGA解析B码----连载3
View mysql deadlock syntax
为什么用Selenium做自动化测试
LeetCode:899. 有序队列【思维题】
香港服务器有哪些常用的型号
验证码业务逻辑漏洞