refactor: 重构模板叠加式编译产物
This commit is contained in:
1 parent
c46297b13b
commit
25d1fe983c
93 files changed
+870
-2467
No files matched your search
+9
-4
@@ -1,11 +1,16 @@
|
||||
const DEFAULT_API_BASE_URL = "http://localhost:3001";
|
||||
const DEFAULT_BRAND_SLUG = "default-brand";
|
||||
const runtimeConfig = require("./runtime-config");
|
||||
|
||||
// 仅开发构建允许用本地 storage 覆盖 API 地址和品牌,便于局域网真机调试。
|
||||
function devOverride(key) {
|
||||
return runtimeConfig.env === "dev" ? wx.getStorageSync(key) : "";
|
||||
}
|
||||
|
||||
App({
|
||||
onLaunch() {
|
||||
this.globalData = {
|
||||
apiBaseUrl: wx.getStorageSync("apiBaseUrl") || DEFAULT_API_BASE_URL,
|
||||
brandSlug: wx.getStorageSync("brandSlug") || DEFAULT_BRAND_SLUG,
|
||||
apiBaseUrl: devOverride("apiBaseUrl") || runtimeConfig.apiBaseUrl,
|
||||
brandSlug: devOverride("brandSlug") || runtimeConfig.brandSlug,
|
||||
templateKey: runtimeConfig.templateKey,
|
||||
brand: {},
|
||||
};
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user