feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -0,0 +1,33 @@
|
||||
Component({
|
||||
properties: {
|
||||
active: { type: String, value: "home" },
|
||||
navigation: { type: Array, value: [] },
|
||||
},
|
||||
data: {
|
||||
tabs: [],
|
||||
},
|
||||
methods: {
|
||||
navigate(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
if (!tab || tab.key === this.data.active) return;
|
||||
wx.navigateTo({ url: tab.page });
|
||||
},
|
||||
},
|
||||
observers: {
|
||||
navigation(navigation) {
|
||||
this.setData({
|
||||
tabs: Array.isArray(navigation)
|
||||
? navigation.map((item) => ({
|
||||
...item,
|
||||
page: item.page && item.page.startsWith("/") ? item.page : `/${item.page || ""}`,
|
||||
}))
|
||||
: [],
|
||||
});
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setData({ tabs: this.data.navigation || [] });
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user