在uniapp当中潜伏掉默认tabbar而且使用自己的tabbar

[复制链接]
发表于 2025-12-25 02:06:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
1. 修改设置
  1. "tabBar": {
  2.         "custom": true,
  3.         "selectedColor": "#ffdead",
  4.         "list": [{
  5.                 "pagePath": "pages/index/index",
  6.                 "text": "首页"
  7.         }]
  8. },
复制代码
  1. //在引入自定义Tabbar组件的时候在载入的时候手动注释一下
  2. import {
  3.         onLoad
  4. } from '@dcloudio/uni-app'
  5. onLoad(() => {
  6.         uni.hideTabBar();
  7. })
  8. //切记app.vue里面也要写一下
  9. onLaunch: function() {
  10.                 console.log('App Launch')
  11.                 uni.hideTabBar()
  12.                 uni.removeStorageSync('selectedIndex')
  13.         },
复制代码
2. 引入组件
  1. //这里跳转的最好是在tabbar的基础上加上根路径要不然是相对地址会错
  2. const tabBarChange = (url) => {
  3.         uni.switchTab({
  4.                 url: url
  5.         })
  6. }
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表