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 || [] });
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="runtime-tab-bar"><view wx:for="{{tabs}}" wx:key="key" class="tab {{active === item.key ? 'active' : ''}}" data-tab="{{item}}" bindtap="navigate"><text class="icon">{{item.key === 'home' ? '⌂' : item.key === 'dishes' ? '♨' : item.key === 'service' ? '⌖' : item.key === 'owner' ? '♙' : item.key === 'booking' ? '✉' : '◈'}}</text><text>{{item.label}}</text></view></view>
|
||||
@@ -0,0 +1,32 @@
|
||||
.runtime-tab-bar {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 10rpx 6rpx calc(10rpx + env(safe-area-inset-bottom));
|
||||
border-top: 1rpx solid #eee5dc;
|
||||
background: rgba(255, 255, 255, 0.97);
|
||||
box-shadow: 0 -8rpx 24rpx rgba(48, 32, 20, 0.08);
|
||||
}
|
||||
.tab {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
color: #9a8d83;
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.icon {
|
||||
height: 34rpx;
|
||||
font-size: 31rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
.tab.active {
|
||||
color: #e87532;
|
||||
font-weight: 700;
|
||||
}
|
||||
Reference in new issue
Block a user