uni-app tab遮盖问题

推荐使用

最外层的view

<view class="pageBottom bg">

</view>

.bg {
    height: 100vh;
    background: #fff;
    box-sizing: border-box;
}
.pageBottom {
    padding-bottom: 100upx;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用uni-app的动画效果和组件来实现带折叠效果的tab切换。以下是一个简单的示例代码,演示了如何实现这个效果: ```html <template> <view class="container"> <view class="tab-bar"> <view class="tab-item" :class="{ active: activeTab === 'tab1' }" @click="toggleTab('tab1')" > Tab 1 </view> <view class="tab-item" :class="{ active: activeTab === 'tab2' }" @click="toggleTab('tab2')" > Tab 2 </view> </view> <view class="content"> <view class="content-item" :class="{ collapsed: activeTab !== 'tab1' }" > Content 1 </view> <view class="content-item" :class="{ collapsed: activeTab !== 'tab2' }" > Content 2 </view> </view> </view> </template> <script> export default { data() { return { activeTab: 'tab1', }; }, methods: { toggleTab(tab) { if (this.activeTab === tab) { this.activeTab = ''; // 折叠当前展开的tab } else { this.activeTab = tab; // 切换到选中的tab } }, }, }; </script> <style> .container { display: flex; flex-direction: column; height: 100vh; } .tab-bar { display: flex; justify-content: space-between; padding: 16px; background-color: #f0f0f0; } .tab-item { padding: 8px 16px; border-radius: 4px; cursor: pointer; } .tab-item.active { background-color: #e0e0e0; } .content { flex: 1; display: flex; flex-direction: column; } .content-item { padding: 16px; transition: height 0.3s ease-in-out; } .content-item.collapsed { height: 0; overflow: hidden; } </style> ``` 在上面的示例中,我们使用了两个tab,通过点击不同的tab来切换展示的内容。activeTab变量用于控制当前选中的tab,通过给选中的tab添加active类名来进行样式的变化。content-item使用了过渡效果,通过改变高度来实现折叠和展开的效果。 你可以根据自己的需要进行样式和布局的调整,以达到你想要的效果。希望对你有所帮助!如果有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值