当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
以自动化赋能转型,飞鹤乳业加速迈向数字化!
工业物联网将取代人工发展吗?
多线程与高并发二:volatile和CAS详细介绍
MySQL 数据库的自动备份操作
猴子都会用的圆形滑动自动吸附UI工具
Summary of the use of composition API in the project
Go 數據類型篇(四)之浮點型與複數類型
Paging query optimization in MySQL of database Series
Scalable storage system (I)
开口式霍尔电流传感器如何助力直流配电改造?
"9 No" principle and "5 measurement dimensions" of extensible system
事件委托的原理
How to automatically add author, time, etc. to eclipse
开启创客教育造物学的领域
局域网内共享打印机的几种方式
A pit filling trip based on LNMP to build a personal website
Li Kou daily question - day 29 -1491 Average wage after removing minimum wage and maximum wage
友链须知
多线程与高并发六:线程池源码解析
继承









