Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsMin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0f2fc7fd
authored
May 28, 2026
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(api): 支持微信小程序环境自动切换
将环境变量设置为开发模式,并添加逻辑以在微信小程序正式版中自动切换为生产模式。
parent
05df8c37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
util/api.js
util/api.js
View file @
0f2fc7fd
// 环境配置:'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
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment