refactor: 统一小程序品牌运行时数据入口
This commit is contained in:
1 parent
accc113b2a
commit
947e6d1ac3
4 files changed
+58
-9
No files matched your search
@@ -1,6 +1,6 @@
|
||||
const { offerings } = require("../../utils/linjing-data");
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
Page({
|
||||
data: { item: null, loading: true },
|
||||
onLoad(options) { const item = offerings.find((entry) => entry.id === options.id) || offerings[0]; this.setData({ item, loading: false }); wx.setNavigationBarTitle({ title: item.category }); },
|
||||
onLoad(options) { loadWorkspaceWithFallback().then((workspace) => { const offerings = workspace.offerings || []; const item = offerings.find((entry) => entry.id === options.id) || offerings[0]; if (!item) return this.setData({ loading: false }); this.setData({ item, loading: false }); wx.setNavigationBarTitle({ title: item.category || item.name }); }); },
|
||||
inquire() { wx.navigateTo({ url: "/pages/inquiry/index?offeringId=" + this.data.item.id }); },
|
||||
});
|
||||
Reference in new issue
Block a user