当前位置:网站首页>[wechat applet development (V)] the interface is intelligently configured according to the official version of the experience version of the development version
[wechat applet development (V)] the interface is intelligently configured according to the official version of the experience version of the development version
2022-07-28 02:48:00 【Sock is a dog】
utils/api.js
// Interface api
// api Request address of
// Get current account information
const accountInfo = wx.getAccountInfoSync();
// env type
var BASE_URL = ""
const baseApi = {
// Development Edition
develop: {
api_host:"https://www.xxx.com"},
// Experience version
trial: {
api_host:"https://www.xxx.com"},
// Official version
release: {
api_host:"https://www.xxxxxxx.com"}
};
// When the phone is in a low version , Write the address directly into the development version
if (!accountInfo.miniProgram.envVersion) {
// console.error(" Failed to get the running environment !");
BASE_URL = baseApi['develop'].api_host
} else {
// request request baseURL
BASE_URL = baseApi[accountInfo.miniProgram.envVersion].api_host
}
module.exports = {
BASE_URL
}
Use
import {
BASE_URL } from "../../utils/api";
边栏推荐
- [understanding of opportunity -53]: Yang Mou stands up and plots to defend himself
- Welcome to CSDN markdown editor Assad
- IO流:节点流和处理流详细归纳。
- 2022.7.8 supplement of empty Luna
- 【英雄哥七月集训】第 26天:并查集
- Four methods of modifying MySQL password (suitable for beginners)
- 【英雄哥七月集训】第 27天:图
- 初识C语言 -- 操作符和关键字,#define,指针
- Necessary knowledge points of software engineering
- LETV responded that employees live an immortal life without internal problems and bosses; Apple refuses to store user icloud data in Russia; Dapr 1.8.0 release | geek headlines
猜你喜欢

Four methods of modifying MySQL password (suitable for beginners)

初识C语言 -- 结构体,分支和循环语句

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

PS simple to use

Explore flex basis

IO流:节点流和处理流详细归纳。
![[self growth website collection]](/img/42/fa17c9167697543defd3e63a97237a.png)
[self growth website collection]

POC simulation attack weapon - Introduction to nucleus (I)

Please, don't use the command line to configure MySQL master-slave replication. Isn't it fragrant to deploy with urlos interface?

The virtual host website cannot access the self-test method
随机推荐
Canvas from getting started to persuading friends to give up (graphic version)
[TA frost wolf \u may hundred people plan] Figure 3.5 early-z and z-prepass
关于Sqli-labs单引号不报错的问题
Eigenvalues and eigenvectors
Is the interface that can be seen everywhere in the program really useful? Is it really right?
Explore flex basis
LoRaWAN中的网关和chirpstack到底如何通信的?UDP?GRPC?MQTT?
Necessary knowledge points of the original group
【英雄哥七月集训】第 26天:并查集
QT implementation disable shortcut key
Red hat official announced the new president and CEO! Paul Cormier, a key figure in transformation, is "retiring"
[leetcode] 13. linked list cycle · circular linked list
When iPhone copies photos to the computer, the device connection often fails and the transmission is interrupted. Here's the way
0动态规划中等 LeetCode873. 最长的斐波那契子序列的长度
程序里随处可见的interface,真的有用吗?真的用对了吗?
MySQL blocking monitoring script
树的孩子兄弟表示法
First knowledge of C language -- structure, branch and loop statements
Say yes, I will love you, and I will love you well
cn+dt