h5-setting.md 1.1 KB

全局配置

基础配置

​ 配置文件所在的目录:/common/env.js,

const MALL_ID = 'd9cd4b96badd8f09e9612ba334aaf9ef' // 全局默认mall_id 【必配项】
const REQUEST_API = 'http://api.testmall.com/' // 全局域名【必配项】
const API_VERSION = 'v.1' // 接口版本号 必配项
const STATIC_DOMAIN = 'http://static.testmall.com' // 静态资源路径【必配项】

代理配置

​ 配置文件所在的目录:/common/manifest.json

"devServer" : {
    "https" : false,
    "disableHostCheck" : true,
        "proxy" : {
            "/api" : {
            "target" : "http://api.testmall.com/",//代理域名配置 【必配项】
            "changeOrigin" : true,
            "secure" : false,
            "pathRewrite" : {
            	"^/api" : ""
            }
        }
    }
},

加载依赖

​ 在其根目录下使用cmd 命令npm i 进行加载依赖。

image-20211102141625259

配置完成,即可使用HBuilderX进行运行前端代码进行调式