add:管理端
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
color: "#B8BBC3",
|
||||
selectedColor: "#312D22",
|
||||
key: 'tabbar_key',
|
||||
list: [
|
||||
{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/static/images/home2.png",
|
||||
selectedIconPath: "/static/images/home.png",
|
||||
text: "订单"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/index",
|
||||
iconPath: "/static/images/user2.png",
|
||||
selectedIconPath: "/static/images/user.png",
|
||||
text: "车辆管理"
|
||||
}
|
||||
]
|
||||
},
|
||||
moved() {
|
||||
console.log('moved')
|
||||
},
|
||||
attached() {
|
||||
try {
|
||||
console.log('attached')
|
||||
this.setData({
|
||||
list: [{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/static/images/order.png",
|
||||
selectedIconPath: "/static/images/order2.png",
|
||||
text: "订单"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/cars/index",
|
||||
iconPath: "/static/images/car.png",
|
||||
selectedIconPath: "/static/images/car2.png",
|
||||
text: "车辆管理"
|
||||
}]
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
// Do something when catch error
|
||||
}
|
||||
|
||||
|
||||
// 可以在这里控制显示
|
||||
},
|
||||
methods: {
|
||||
switchTab(e) {
|
||||
const data = e.currentTarget.dataset
|
||||
const url = data.path
|
||||
wx.switchTab({ url })
|
||||
this.setData({
|
||||
selected: data.index
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<!--miniprogram/custom-tab-bar/index.wxml-->
|
||||
<cover-view class="tab-bar">
|
||||
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
|
||||
<cover-image class="tab-bar-item-img" src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></cover-image>
|
||||
<cover-view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</cover-view>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
@@ -0,0 +1,28 @@
|
||||
.tab-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 48px;
|
||||
background: white;
|
||||
display: flex;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
box-shadow: 0rpx -1rpx 0rpx 0rpx #ECECEC;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.tab-bar-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-bar-item .tab-bar-item-img {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user