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

边栏推荐
- 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
- Nexus 6p从8.0降级6.0+root
- 509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
- FRP intranet penetration, reverse proxy
- C realize Snake games
- Component、Container容器常用API详解:Frame、Panel、ScrollPane
- QT releases multilingual International Translation
- Sort list tool class, which can sort strings
- Appium基础 — APPium安装(二)
- Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
猜你喜欢

Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)

JSON Web Token----JWT和傳統session登錄認證對比

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

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

Distributed cap theory

Leakage detection relay jy82-2p

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

QT 获取随机颜色值设置label背景色 代码

双色球案例

SQL join, left join, right join usage
随机推荐
剑指 Offer II 038. 每日温度
JS arguments parameter usage and explanation
Json Web token - jwt vs. Traditional session login Authentication
AWT introduction
Invalid revision: 3.18.1-g262b901-dirty
JS flattened array of number shape structure
js arguments参数使用和详解
Learning multi-level structural information for small organ segmentation
gslb(global server load balance)技术的一点理解
My NVIDIA developer journey - optimizing graphics card performance
How to implement cross domain requests
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
C réaliser des jeux de serpents gourmands
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
How to avoid JVM memory leakage?
MySQL installation and configuration
采用中微BATG135实现IIC数据/指令交互
JS execution mechanism
分布式CAP理论
Win10 clear quick access - leave no trace