当前位置:网站首页>Uniapp custom environment variables
Uniapp custom environment variables
2022-07-04 06:23:00 【@Time Traveler】
1、 Create in the root directory package.json file , Write the following , Refer to the official website for specific configuration items package.json
{
"uni-app": {
"scripts": {
"dev": {
// Configuration item name
"title":"h5 Test environment ", // Name on the menu toolbar
"env": {
"UNI_PLATFORM": "h5" // platform
},
"define": {
"H5-DEV": true // Variable name
}
},
"prod": {
"title":"h5 Production environment ",
"env": {
"UNI_PLATFORM": "h5"
},
"define": {
"H5-PROD": true
}
}
}
}
}
2、 Using environment variables
// #ifdef H5-DEV
console.log('dev')
// #endif
// #ifdef H5-PROD
console.log('prod')
// #endif
3、 Compile the package
边栏推荐
- The difference between PX EM rem
- How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
- ES6 modularization
- QT releases multilingual International Translation
- 【无标题】
- Appium foundation - appium installation (II)
- Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
- 如何获取el-tree中所有节点的父节点
- Understanding of cross domain and how to solve cross domain problems
- Json Web token - jwt vs. Traditional session login Authentication
猜你喜欢
InputStream/OutputStream(文件的输入输出)
How to realize multi account login of video platform members
C语言练习题(递归)
Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.
4G wireless all network solar hydrological equipment power monitoring system bms110
JS arguments parameter usage and explanation
gslb(global server load balance)技术的一点理解
剑指 Offer II 038. 每日温度
How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
740. Delete and get points
随机推荐
js arguments参数使用和详解
Inputstream/outputstream (input and output of file)
ES6 modularization
[microservice] Nacos cluster building and loading file configuration
JS execution mechanism
C réaliser des jeux de serpents gourmands
Overview of convolutional neural network structure optimization
QT releases multilingual International Translation
Understanding of cross domain and how to solve cross domain problems
Practical gadget instructions
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
手动对list进行分页(参数list ,当前页,页面大小)
树形dp
Manually page the list (parameter list, current page, page size)
The end of the Internet is rural revitalization
JSON Web Token----JWT和传统session登录认证对比
Which water in the environment needs water quality monitoring
C language - Blue Bridge Cup - Snake filling
C language exercises (recursion)