当前位置:网站首页>How the uni app automatically switches the requested address according to the environment
How the uni app automatically switches the requested address according to the environment
2022-06-28 03:49:00 【Dark_ programmer】
stay vue in , You can use process.env.NODE_ENV To determine whether the current environment is a development environment or a production environment . stay uni-app This value can also be used in to distinguish environments .
Use HBuilderX Development :
Click on “ function ” The compiled code is the development environment , Click on “ issue ” The compiled code is the production environment
export default BASE_URL = process.env.NODE_ENV === 'development' ? ' Address of the test ' : ' Official address '
Then use the variable in the right place
Or in package.json Middle configuration
https://uniapp.dcloud.io/collocation/package
边栏推荐
- 多线程与高并发六:线程池源码解析
- 用于 C# 的 SQL 基本语法总结
- MySQL错误
- Change of monitoring documents and folders of "operation and maintenance department"
- Object floating tool
- TypeError: &# 039; module&# 03…
- INFO: HHH000397: Using…
- 电子地图坐标系统研究整理
- Summary of the use of composition API in the project
- 基于 LNMP 搭建个人网站的填坑之旅
猜你喜欢

局域网内共享打印机的几种方式

Change of monitoring documents and folders of "operation and maintenance department"

资源管理、高可用与自动化(中)

双亲委派机制的理解学习

A solution to the inefficiency of setting debug mode in developing flask framework with pychar

WebSocket(简单体验版)

Simple implementation of cool GUI window based on WPF

数字电路学习笔记(一)

可扩展存储系统(上)

基于 WPF 的酷炫 GUI 窗口的简易实现
随机推荐
物体上下漂浮工具
Typescript union type
可扩展数据库(下)
小程序输入框闪动?
STM32 peripheral SDIO and SD card configuration
kubernetes资源对象介绍及常用命令
Is Guotai Junan Securities reliable? Is it safe to open a securities account?
机器人编程教育的市场竞争力
可扩展系统的“9不”原则和“5个”衡量维度
力扣每日一题-第29天-575.分糖果
用Pycharm开发Flask框架设置debug模式没有效果的解决办法
猴子都会用的圆形滑动自动吸附UI工具
No  result  defined& nbsp…
Web APIs DOM-事件基础丨黑马程序员
Go 数据类型篇(四)之浮点型与复数类型
Pycharm setting pseudo sublime color scheme
Li Kou daily question - day 29 -1491 Average wage after removing minimum wage and maximum wage
如何系统学习一门编程语言? | 黑马程序员
Floating point and complex type of go data type (4)
Extensible database (Part 2)