当前位置:网站首页>uniapp 自定义环境变量
uniapp 自定义环境变量
2022-07-04 06:22: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、编译打包
边栏推荐
- js arguments参数使用和详解
- Tsinghua University product: penalty gradient norm improves generalization of deep learning model
- STM32 单片机ADC 电压计算
- Qt发布多语言国际化翻译
- Leakage detection relay jy82-2p
- 注释与注解
- How to use multithreading to export excel under massive data? Source code attached!
- Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
- Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
- JSON web token -- comparison between JWT and traditional session login authentication
猜你喜欢
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
Which water in the environment needs water quality monitoring
Sleep quality today 78 points
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
体验碎周报第 102 期(2022.7.4)
SQL injection SQL lab 11~22
Layoutmanager layout manager: flowlayout, borderlayout, GridLayout, gridbaglayout, CardLayout, BoxLayout
InputStream/OutputStream(文件的输入输出)
Win10 clear quick access - leave no trace
C语言中的函数(详解)
随机推荐
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
C realize Snake games
Considerations for testing a website
Detectron: train your own data set -- convert your own data format to coco format
A little understanding of GSLB (global server load balance) technology
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
C language - Blue Bridge Cup - Snake filling
树形dp
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
Experience weekly report no. 102 (July 4, 2022)
ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
Webrtc quickly set up video call and video conference
Configure cross compilation tool chain and environment variables
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
MySQL的information_schema数据库
报错cvc-complex-type.2.4.a: 发现了以元素 ‘base-extension‘ 开头的无效内容。应以 ‘{layoutlib}‘ 之一开头。
Fast power (template)
JSON Web Token----JWT和傳統session登錄認證對比
手动对list进行分页(参数list ,当前页,页面大小)