当前位置:网站首页>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、編譯打包
边栏推荐
- How to realize multi account login of video platform members
- JS execution mechanism
- 实用的小工具指令
- Native Cloud - SSH articles must be read on Cloud (used for Remote Login to Cloud Server)
- Webrtc quickly set up video call and video conference
- A little understanding of GSLB (global server load balance) technology
- HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
- Component、Container容器常用API详解:Frame、Panel、ScrollPane
- Sleep quality today 78 points
- Compound nonlinear feedback control (2)
猜你喜欢
How to use multithreading to export excel under massive data? Source code attached!
Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
双色球案例
C language - Blue Bridge Cup - Snake filling
Which water in the environment needs water quality monitoring
C réaliser des jeux de serpents gourmands
R statistical mapping - random forest classification analysis and species abundance difference test combination diagram
[March 3, 2019] MAC starts redis
Learning multi-level structural information for small organ segmentation
AWT introduction
随机推荐
安装 Pytorch geometric
4G wireless all network solar hydrological equipment power monitoring system bms110
FRP intranet penetration, reverse proxy
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
MySQL installation and configuration
Bicolor case
Sleep quality today 78 points
[Chongqing Guangdong education] electronic circuit homework question bank of RTVU secondary school
ES6 模块化
Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
Install pytoch geometric
对List进行排序工具类,可以对字符串排序
Lightroom import picture gray / Black rectangular multi display
Json Web token - jwt vs. Traditional session login Authentication
【微服务】Nacos集群搭建以及加载文件配置
QT releases multilingual International Translation
27-31. Dependency transitivity, principle
Native Cloud - SSH articles must be read on Cloud (used for Remote Login to Cloud Server)
实用的小工具指令
Functions in C language (detailed explanation)