当前位置:网站首页>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、編譯打包
边栏推荐
- Arcpy uses the updatelayer function to change the symbol system of the layer
- Appium基础 — APPium安装(二)
- HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
- C language - Blue Bridge Cup - Snake filling
- Vant --- detailed explanation and use of list component in vant
- 70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
- SQL join, left join, right join usage
- Practical gadget instructions
- 27-31. Dependency transitivity, principle
- JS get the attribute values nested in the object
猜你喜欢
Overview of convolutional neural network structure optimization
Leetcode question brushing record | 206_ Reverse linked list
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
测试岗的中年危机该如何选择?是坚守还是另寻出路?且看下文
ES6 模块化
Notes and notes
webrtc 快速搭建 视频通话 视频会议
MySQL learning notes 3 - JDBC
Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.
C language - Blue Bridge Cup - Snake filling
随机推荐
Manually page the list (parameter list, current page, page size)
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
Webrtc quickly set up video call and video conference
The difference between PX EM rem
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
R统计绘图-随机森林分类分析及物种丰度差异检验组合图
采用中微BATG135实现IIC数据/指令交互
How to avoid JVM memory leakage?
Which water in the environment needs water quality monitoring
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
How to solve the component conflicts caused by scrollbars in GridView
Weekly summary (*63): about positive energy
MySQL的information_schema数据库
[Chongqing Guangdong education] electronic circuit homework question bank of RTVU secondary school
Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
Json Web token - jwt vs. Traditional session login Authentication
QT 获取随机颜色值设置label背景色 代码
Layoutmanager layout manager: flowlayout, borderlayout, GridLayout, gridbaglayout, CardLayout, BoxLayout
Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
px em rem的区别