9 lines
844 B
JavaScript
9 lines
844 B
JavaScript
const { offerings } = require("../../utils/linjing-data");
|
|
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
|
Page({
|
|
data: { loading: false, error: "", offerings, filtered: offerings, modules: [], theme: {}, category: "全部" },
|
|
onLoad() { loadWorkspaceWithFallback().then((workspace) => { const items = workspace.offerings || offerings; this.setData({ offerings: items, filtered: items, modules: workspace.modules || [], theme: workspace.theme || {} }); }); },
|
|
switchCategory(e) { const category = e.currentTarget.dataset.category; const items = this.data.offerings || offerings; this.setData({ category, filtered: category === "全部" ? items : items.filter((item) => item.category === category) }); },
|
|
open(e) { wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id }); },
|
|
});
|