You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.0 KiB
Vue

11 months ago
<template>
11 months ago
<view>
<u-tabbar :value="current"
@change="changeTab"
11 months ago
:fixed="true"
:placeholder="false"
11 months ago
:safeAreaInsetBottom="true"
:border="false"
activeColor="#FFC748"
inactiveColor="#1D1D1D">
<u-tabbar-item v-for="(item,index) in tabBarList"
:key="index"
:text="item.text">
<image class="u-page__item__slot-icon"
11 months ago
slot="inactive-icon"
11 months ago
:src="item.iconPath"></image>
<image class="u-page__item__slot-icon"
11 months ago
slot="active-icon"
11 months ago
:src="item.selectedIconPath"></image>
11 months ago
</u-tabbar-item>
</u-tabbar>
11 months ago
11 months ago
</view>
</template>
<script>
export default {
11 months ago
props: {
currentPage: String
},
11 months ago
data () {
11 months ago
return {
11 months ago
current: 0,
tabBarList: [{
pagePath: "pages/ticket/index",
iconPath: "../../static/tabbar/icon-ticket.png",
selectedIconPath: "../../static/tabbar/icon-ticket-active.png",
text: '场馆',
customIcon: false,
},
{
pagePath: "pages/my/my",
iconPath: "../../static/tabbar/icon-mine.png",
selectedIconPath: "../../static/tabbar/icon-mine-active.png",
text: '我的',
customIcon: false,
}
]
};
11 months ago
},
methods: {
11 months ago
changeTab (e) {
let page = '/' + this.tabBarList[e].pagePath
console.log(page);
uni.switchTab({
url: page,
success: () => {
},
fail: (e) => {
console.log(e);
}
})
11 months ago
}
11 months ago
},
created () {
//隐藏原生tabbar
uni.hideTabBar();
// 当前选中的菜单
this.tabBarList.forEach((i, index) => {
if (i.pagePath == this.currentPage) {
this.current = index
}
})
},
11 months ago
}
</script>
11 months ago
<style lang="scss" scoped>
.u-page__item__slot-icon {
width: 76rpx;
height: 76rpx;
}
.u-tabbar /deep/ .u-tabbar--fixed {
width: 100%;
height: 88rpx;
padding: 20px 0;
background: #ffffff;
}
</style>