uniapp中使用弹出框控制Tab栏区域显示与隐藏

在uniapp中提供控制TabBar的显示与隐藏的函数  uni.hideTabBar() 与 uni.showTabBar()

<nut-button block type="primary" @click="JDdetail()" >立即接单</nut-button>
<---弹出框--->
<nut-popup style="z-index: 999;" position="bottom" closeable :custom-style="{ height: '70%' }" v-model:visible="showIcon">
</nut-popup>

const isshow=ref(false)//控制弹出框的显示与隐藏

// 监听弹出框变化来显示与隐藏TabBar
watch(showIcon, (newValue, oldValue) => {
  if(newValue){
    uni.hideTabBar()
  }else{
    uni.showTabBar()
  }
});

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Uniapp ,可以通过控制 tabBar 的 list 来实现某一项的显示隐藏。以下是一个示例代码: 1. 在 App.vue 文件,配置 tabBar 的 list 项,例如: ```vue <template> <div> <tab-bar :list="tabBarList" :selected="selectedTab" @click="tabBarClick"></tab-bar> <router-view></router-view> </div> </template> <script> export default { data() { return { selectedTab: 0, tabBarList: [ { iconPath: "home", selectedIconPath: "home-fill", text: "首页", pagePath: "/pages/home/home" }, { iconPath: "category", selectedIconPath: "category-fill", text: "分类", pagePath: "/pages/category/category" }, { iconPath: "cart", selectedIconPath: "cart-fill", text: "购物车", pagePath: "/pages/cart/cart" }, { iconPath: "profile", selectedIconPath: "profile-fill", text: "个人心", pagePath: "/pages/profile/profile" } ] }; }, methods: { tabBarClick(index) { this.selectedTab = index; } } }; </script> ``` 2. 如果要隐藏某一项,可以在 `tabBarList` 移除对应的项: ```vue export default { data() { return { selectedTab: 0, tabBarList: [ // 隐藏第二个 tab { iconPath: "home", selectedIconPath: "home-fill", text: "首页", pagePath: "/pages/home/home" }, { iconPath: "cart", selectedIconPath: "cart-fill", text: "购物车", pagePath: "/pages/cart/cart" }, { iconPath: "profile", selectedIconPath: "profile-fill", text: "个人心", pagePath: "/pages/profile/profile" } ] }; }, methods: { tabBarClick(index) { this.selectedTab = index; } } }; ``` 这样,第二个 tab 就会被隐藏起来。 通过以上方法,你可以在 Uniapp 动态控制 tabBar 的显示隐藏,根据需要调整 tabBar 的样式和其他配置信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值