当前位置:网站首页>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、编译打包

边栏推荐
- 剑指 Offer II 038. 每日温度
- JSON Web Token----JWT和传统session登录认证对比
- ES6 模块化
- 17-18. Dependency scope and life cycle plug-ins
- Vant --- detailed explanation and use of list component in vant
- STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
- buuctf-pwn write-ups (8)
- Arcpy uses the updatelayer function to change the symbol system of the layer
- Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
- How to implement lazy loading in El select (with search function)
猜你喜欢

Sleep quality today 78 points

How to use multithreading to export excel under massive data? Source code attached!

The end of the Internet is rural revitalization

树形dp

InputStream/OutputStream(文件的输入输出)

JS flattened array of number shape structure

Detectron: train your own data set -- convert your own data format to coco format

我的NVIDIA开发者之旅——优化显卡性能

HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)

Design and implementation of redis 7.0 multi part AOF
随机推荐
Reading notes of Clickhouse principle analysis and Application Practice (4)
QT get random color value and set label background color code
JS get the attribute values nested in the object
配置交叉编译工具链和环境变量
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
体验碎周报第 102 期(2022.7.4)
Invalid revision: 3.18.1-g262b901-dirty
C language - Blue Bridge Cup - Snake filling
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
How to realize multi account login of video platform members
How to expand all collapse panels
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
STM32 单片机ADC 电压计算
运算符<< >>傻瓜式测试用例
《ClickHouse原理解析与应用实践》读书笔记(4)
[untitled]
[microservice] Nacos cluster building and loading file configuration
px em rem的区别
对List进行排序工具类,可以对字符串排序
Design and implementation of redis 7.0 multi part AOF