自定义的tabbar组件
css
.k-tabbar {
display: flex;
justify-content: space-around;
font-size: 12px;
z-index: 999;
padding-top: 10px;
left: 0;
position: fixed;
bottom: 0;
width: 100%;
background-color: $blue;
&-red {
background: $red;
}
.tabbar-content {
display: flex;
flex-direction: column;
align-items: center;
height: 50px;
color: #bbb;
&.active {
color: #fff;
}
}
}
html
<view class="k-tabbar" :class="curThemeType == '蓝色海洋' ? '' : 'k-tabbar-red'">
<template v-for="item in tabData">
<view :key="item.name" class="tabbar-content" :class="item.name == tabName ? 'active' : ''"
@click="handleClick(item.path)">
<u-icon :name="item.icon" :color="item.name == tabName ? '#fff' : '#bbb'"></u-icon>
<view>{{ item.title }}</view>
</view>
</template>
</view>
tabbar 组件引入到 其他页面的时候 总是遮挡底部内容
这种问题怎么解决 能让页面内容高度auto 并且不被遮挡住
.page-content {
padding-bottom: 50px;
}
或者
.page-content {
margin-bottom: 50px;
}
CSS 有一个 safe-area 的概念,可以参考
JELLY | 网页适配 iPhoneX,就是这么简单
env() - CSS: Cascading Style Sheets | MDN