当前位置:网站首页>uniapp 自定義環境變量
uniapp 自定義環境變量
2022-07-04 06:23:00 【@時空旅人】
1、在根目錄下創建 package.json 文件,寫入以下內容,具體配置項參考官網 package.json
{
"uni-app": {
"scripts": {
"dev": {
// 配置項名稱
"title":"h5測試環境", // 在菜單工具欄上的名稱
"env": {
"UNI_PLATFORM": "h5" // 平臺
},
"define": {
"H5-DEV": true // 變量名
}
},
"prod": {
"title":"h5生產環境",
"env": {
"UNI_PLATFORM": "h5"
},
"define": {
"H5-PROD": true
}
}
}
}
}
2、使用環境變量
// #ifdef H5-DEV
console.log('dev')
// #endif
// #ifdef H5-PROD
console.log('prod')
// #endif
3、編譯打包

边栏推荐
- STM32 单片机ADC 电压计算
- AWT常用组件、FileDialog文件选择框
- 复合非线性反馈控制(二)
- 注释与注解
- How to implement lazy loading in El select (with search function)
- SQL join, left join, right join usage
- Tsinghua University product: penalty gradient norm improves generalization of deep learning model
- [Chongqing Guangdong education] electronic circuit homework question bank of RTVU secondary school
- Inputstream/outputstream (input and output of file)
- 【微服务】Nacos集群搭建以及加载文件配置
猜你喜欢

AWT介绍

buuctf-pwn write-ups (8)

AWT common components, FileDialog file selection box

《ClickHouse原理解析与应用实践》读书笔记(4)

Weekly summary (*63): about positive energy

Which water in the environment needs water quality monitoring

Design and implementation of redis 7.0 multi part AOF

配置交叉编译工具链和环境变量

【无标题】

体验碎周报第 102 期(2022.7.4)
随机推荐
Learning multi-level structural information for small organ segmentation
Common JS tool Libraries
How to expand all collapse panels
C实现贪吃蛇小游戏
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
双色球案例
How to determine whether an array contains an element
How to avoid JVM memory leakage?
AWT介绍
QT 获取随机颜色值设置label背景色 代码
如何避免 JVM 内存泄漏?
Leetcode question brushing record | 206_ Reverse linked list
Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
[Chongqing Guangdong education] electronic circuit homework question bank of RTVU secondary school
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
Which water in the environment needs water quality monitoring
JS flattened array of number shape structure
Invalid revision: 3.18.1-g262b901-dirty
Native Cloud - SSH articles must be read on Cloud (used for Remote Login to Cloud Server)
Lightroom import picture gray / Black rectangular multi display