init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
color: '#7A7E83',
|
||||
selectedColor: '#3B7CFC',
|
||||
list: [
|
||||
{
|
||||
pagePath: '/pages/maintenanceIndex/maintenanceIndex',
|
||||
iconPath: '/images/icon_tabbar_h.png',
|
||||
selectedIconPath: '/images/icon_tabbar_hs.png',
|
||||
text: '工作台'
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/backlog/backlogList/backlogList',
|
||||
iconPath: '/images/icon_tabbar2.png',
|
||||
selectedIconPath: '/images/icon_tabbar2.png',
|
||||
text: '待办'
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/addressBook/addressBook',
|
||||
iconPath: '/images/icon_tabbar_n.png',
|
||||
selectedIconPath: '/images/icon_tabbar_ns.png',
|
||||
text: '通讯录'
|
||||
}
|
||||
]
|
||||
},
|
||||
attached() {},
|
||||
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,62 @@
|
||||
.tab-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 120px;
|
||||
background: transparent;
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
.tab-bar-bg {
|
||||
width: 100vw;
|
||||
height: 120px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.tab-bar-list {
|
||||
width: 100%;
|
||||
// height: 80px;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 86rpx;
|
||||
// bottom: 0;
|
||||
.tab-bar-item {
|
||||
padding-top: 8px;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
image {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
view {
|
||||
margin-top: 10px;
|
||||
color: #737373;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.tab-bar-item:nth-child(2) {
|
||||
image {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
position: absolute;
|
||||
top: -24px;
|
||||
}
|
||||
view {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!--miniprogram/custom-tab-bar/index.wxml-->
|
||||
<view class="tab-bar">
|
||||
<view class="tab-bar-bg">
|
||||
<image src="../images/bg_tabbar.png" mode=""/>
|
||||
</view>
|
||||
<view class="tab-bar-list">
|
||||
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
|
||||
<image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
|
||||
<view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
Reference in New Issue
Block a user