app.wpy 是入口文件,很多东西例如 globalData intercept onLaunch 都需要在这里配置。
其中 config 属性对应原生的 app.json 文件,build 编译时会根据 config 属性自动生成 app.json 文件,如果需要修改 config 中的内容,请使用微信提供的相关 API。
在 app.wpy 中,在 constructor 里的 intercept 里的 config 里,通过 url 是否开头含有 http:// 或 https:// 判断是否需要对通过 wepy.request 的请求添加 apiDomain ,起到类似 axios baseURL 的作用
if (!(/^https?:\/\//.test(p.url))) {