当前位置:网站首页>【微信小程序开发(五)】接口按照根据开发版体验版正式版智能配置
【微信小程序开发(五)】接口按照根据开发版体验版正式版智能配置
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";
边栏推荐
- 【LeetCode】13. Linked List Cycle·环形链表
- Lock mechanism in MySQL database InnoDB storage engine (glory Collection Edition)
- 基于FPGA的64位8级流水线加法器
- Canvas 从入门到劝朋友放弃(图解版)
- unordered_ The hash function of map and the storage mode of hash bucket
- How is insert locked in MySQL? (glory Collection Edition)
- mysql: error while loading shared libraries: libtinfo.so. 5 solutions
- 并发编程的三大核心问题(荣耀典藏版)
- Usage of delegate
- Canonical Address
猜你喜欢
![[advanced ROS] Lecture 9 robot model motion based on rviz and arbotix control](/img/7f/f0360210e8a9f7e45410d79635bfd9.png)
[advanced ROS] Lecture 9 robot model motion based on rviz and arbotix control

MySQL high availability and master-slave synchronization

Soft test - database (2) relational model

Canvas from getting started to persuading friends to give up (graphic version)
![[advanced ROS chapter] Lecture 10 gadf integrated simulation process and examples based on gazebo](/img/d0/5fa2ae7fc7866b7a55cf103da4519d.png)
[advanced ROS chapter] Lecture 10 gadf integrated simulation process and examples based on gazebo

POC模拟攻击利器 —— Nuclei入门(一)

What problems should be avoided when using BigDecimal type? (glory Collection Edition)

AWS elastic three swordsman

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

From prediction to decision-making, Chapter 9 Yunji datacanvas launched the ylearn causal learning open source project
随机推荐
Welcome to CSDN markdown editor Assad
Is the interface that can be seen everywhere in the program really useful? Is it really right?
MySQL high availability and master-slave synchronization
【英雄哥七月集训】第 26天:并查集
Achievements in science and Technology (XXVIII)
New infrastructure helps the transformation and development of intelligent road transportation
Wechat campus maintenance and repair applet graduation design finished product of applet completion work (4) opening report
功能测试和非功能测试区别简析,上海好口碑软件测试公司推荐
unordered_map的hash function及hash bucket存储方式探索
【信号去噪】基于卡尔曼滤波实现信号去噪附matlab代码
Flask1.1.4 werkzeug1.0.1 source code analysis: Blueprint
First knowledge of C language -- operators and keywords, define, pointer
Necessary knowledge points of the original group
Find - block search
Manual installation of Dlib Library
【HCIP】BGP 特性
第二季度邮件安全报告:邮件攻击暴增4倍,利用知名品牌获取信任
Leetcode judge whether palindrome number
[solution] solve the problem of SSH connection being inactive for a long time and being stuck and disconnected
C # introducing WinAPI to pass the character set of Chinese string parameters