当前位置:网站首页>【微信小程序开发(五)】接口按照根据开发版体验版正式版智能配置
【微信小程序开发(五)】接口按照根据开发版体验版正式版智能配置
2022-07-28 01:39:00 【袜子是一只狗】
utils/api.js
// 接口api
// api的请求地址
// 获取当前帐号信息
const accountInfo = wx.getAccountInfoSync();
// env类型
var BASE_URL = ""
const baseApi = {
// 开发版
develop: {
api_host:"https://www.xxx.com"},
// 体验版
trial: {
api_host:"https://www.xxx.com"},
// 正式版
release: {
api_host:"https://www.xxxxxxx.com"}
};
//当手机处于低版本的情况下,直接将地址写成开发版的
if (!accountInfo.miniProgram.envVersion) {
// console.error("获取运行环境失败!");
BASE_URL = baseApi['develop'].api_host
} else {
// request请求baseURL
BASE_URL = baseApi[accountInfo.miniProgram.envVersion].api_host
}
module.exports = {
BASE_URL
}
使用
import {
BASE_URL } from "../../utils/api";
边栏推荐
- 使用BigDecimal类型应该避免哪些问题?(荣耀典藏版)
- 数字孪生农业丨智慧农业稻米加工厂从“看天吃饭”到“知天而作”
- 2020.7.7 eth price analysis
- Common SQL statement query
- MySQL是如何利用索引的(荣耀典藏版)
- 初识C语言 -- 结构体,分支和循环语句
- Design of edit memory path of edit box in Gui
- Canvas 从入门到劝朋友放弃(图解版)
- What problems should be avoided when using BigDecimal type? (glory Collection Edition)
- How MySQL uses indexes (glory Collection Edition)
猜你喜欢

From prediction to decision-making, Chapter 9 Yunji datacanvas launched the ylearn causal learning open source project

基于stm32的恒功率无线充电

Four methods of modifying MySQL password (suitable for beginners)

Interpretation of cesium3dtilesets using customshader and examples of Omni effects
![[TA frost wolf \u may - hundred people plan] Figure 3.7 TP (d) r architecture of mobile terminal](/img/9c/695294c673aa559462b4afe8eb5253.png)
[TA frost wolf \u may - hundred people plan] Figure 3.7 TP (d) r architecture of mobile terminal

With elephant & nbsp; Eplato created by swap, analysis of the high premium behind it

Wechat campus bathroom reservation applet graduation design finished product (3) background function

The virtual host website cannot access the self-test method
![[solution] solve the problem of SSH connection being inactive for a long time and being stuck and disconnected](/img/66/99bd61223cbe622db3e28474f4fa15.png)
[solution] solve the problem of SSH connection being inactive for a long time and being stuck and disconnected

Chapter III queue
随机推荐
1313_pyserial的安装以及文档的生成
Representation of children and brothers of trees
POC simulation attack weapon - Introduction to nucleus (I)
2022.7.8 supplement of empty Luna
JVM tuning -xms -xmx -xmn -xss
C # introducing WinAPI to pass the character set of Chinese string parameters
初识C语言 -- 操作符和关键字,#define,指针
What is eplato cast by Plato farm on elephant swap?
MySQL是如何利用索引的(荣耀典藏版)
[advanced ROS chapter] Lecture 10 gadf integrated simulation process and examples based on gazebo
2020.7.7 eth price analysis
[TA frost wolf \u may hundred people plan] Figure 3.5 early-z and z-prepass
MySQL 中的 INSERT 是怎么加锁的?(荣耀典藏版)
Wechat campus bathroom reservation applet graduation design finished product (3) background function
Deep Residual Learning for Image Recognition浅读与实现
New infrastructure helps the transformation and development of intelligent road transportation
A 64 bit 8-stage pipelined adder based on FPGA
Flask1.1.4 werkzeug1.0.1 source code analysis: Blueprint
MySQL blocking monitoring script
Read Plato & nbsp; Eplato of farm and the reasons for its high premium