当前位置:网站首页>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、编译打包
边栏推荐
- STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
- The difference between PX EM rem
- Arcpy 利用updatelayer函数改变图层的符号系统
- Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
- Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
- C实现贪吃蛇小游戏
- Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?
- Reading notes of Clickhouse principle analysis and Application Practice (4)
- MySQL information_ Schema database
- Json Web token - jwt vs. Traditional session login Authentication
猜你喜欢
如何实现视频平台会员多账号登录
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
Reading notes of Clickhouse principle analysis and Application Practice (4)
每周小结(*63):关于正能量
After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
QT qtablewidget table column top requirements ideas and codes
Abap:ooalv realizes the function of adding, deleting, modifying and checking
Detectron: train your own data set -- convert your own data format to coco format
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
Experience weekly report no. 102 (July 4, 2022)
随机推荐
Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
Practical gadget instructions
Overview of convolutional neural network structure optimization
win10清除快速访问-不留下痕迹
ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
QT 获取随机颜色值设置label背景色 代码
Gridview出现滚动条,组件冲突,如何解决
Sort list tool class, which can sort strings
Functions in C language (detailed explanation)
JS arguments parameter usage and explanation
How to help others effectively
如何实现视频平台会员多账号登录
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
AWT介绍
Inputstream/outputstream (input and output of file)
24 magicaccessorimpl can access the debugging of all methods
Understanding of cross domain and how to solve cross domain problems
Webrtc quickly set up video call and video conference
C语言中的排序,实现从小到大的数字排序法
MySQL installation and configuration