Commit 0f2fc7fd by liangjianmin

feat(api): 支持微信小程序环境自动切换

将环境变量设置为开发模式,并添加逻辑以在微信小程序正式版中自动切换为生产模式。
parent 05df8c37
Showing with 15 additions and 1 deletions
// 环境配置:'production' 正式环境 | 'development' 测试环境
var ENV = 'production';
var ENV = 'development';
// 微信小程序线上(正式版)自动切换为 production
// #ifdef MP-WEIXIN
try {
var accountInfo = uni.getAccountInfoSync();
var envVersion = accountInfo.miniProgram.envVersion;
// envVersion: develop(开发版) | trial(体验版) | release(正式版)
if (envVersion === 'release') {
ENV = 'production';
}
} catch (e) {
console.warn('[环境] 获取小程序版本信息失败', e);
}
// #endif
// 环境配置映射
var ENV_CONFIG = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment