76 lines
1.7 KiB
Vue
76 lines
1.7 KiB
Vue
<template>
|
|
<view class="hj-tabbar">
|
|
<view class="hj-tabbar-item" v-for="item in list" :key="item.key" @click="go(item)">
|
|
<image class="hj-tabbar-icon" :src="current === item.key ? item.activeIcon : item.icon" mode="aspectFit"></image>
|
|
<text class="hj-tabbar-text" :class="{ active: current === item.key }">{{ item.text }}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'hj-tabbar',
|
|
props: {
|
|
current: {
|
|
type: String,
|
|
default: 'index'
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
list: [
|
|
{ key: 'index', text: '首页', path: '/pages/hj-index/hj-index', icon: '/static/shouye.png', activeIcon: '/static/shouye_select.png' },
|
|
{ key: 'winRecords', text: '中奖记录', path: '/pages/hj-win-records/hj-win-records', icon: '/static/zhongjiangjilu.png', activeIcon: '/static/zhongjiangjilu_select.png' },
|
|
{ key: 'profile', text: '我的', path: '/pages/hj-profile/hj-profile', icon: '/static/wode.png', activeIcon: '/static/wode_select.png' }
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
go(item) {
|
|
if (item.key === this.current) return
|
|
uni.reLaunch({ url: item.path })
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.hj-tabbar {
|
|
position: fixed;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
z-index: 998;
|
|
height: 120rpx;
|
|
display: flex;
|
|
background: linear-gradient(to bottom, #FFEBBC, #FFD67E);
|
|
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.hj-tabbar-item {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 16rpx 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.hj-tabbar-icon {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
}
|
|
|
|
.hj-tabbar-text {
|
|
font-size: 22rpx;
|
|
color: #5D533D;
|
|
margin-top: 4rpx;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.hj-tabbar-text.active {
|
|
color: #FD5401;
|
|
}
|
|
</style>
|