小程序 custom-tab-bar 层级无法被覆盖,迂回解决方案
时间:2020-12-04 16:47:48
收藏:0
阅读:139
看到小程序开发论坛里讨论的问题,我这也碰到了,无法覆盖tab-bar层级,怎么办?
解决方案:使用if 控制隐藏/展示 tabbar
1.在自定义custom-tab-bar组件 index.js中添加 show 属性
data: { show:true }
2.在index.wxml中添加if语句
<view class="custom-tab" wx:if="{{show}}"> 中间内容省略 </view>
3.在需要使用dialog前调用--隐藏tabbar
this.getTabBar().setData({ show: false, });
4.在关闭dialog后 调用--显示tabbar
this.getTabBar().setData({ show: true, });
原文:https://www.cnblogs.com/zjhblogs/p/14086327.html
评论(0)