小工具知识网

当前位置: 首页 > 行业知识 > 微信程序 自定义遮罩层遮不住底部tabbar解决

行业知识

微信程序 自定义遮罩层遮不住底部tabbar解决

2026-10-31 23:09:31 来源:互联网转载

一、先上效果

二 方法

1、自定义底部tabbar

实���:

https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html 官网去抄

简单写下:在代码根目录下添加入口文件 除了js 文件的list 需要调整 其他原封不动

代码:

js部分

Component({  data: {    selected: 0,    color: "#7A7E83",    selectedColor: "#0081FF",    list: [{  // 同app.json下的tabbar列表        "iconPath": "/assets/img/build.png",        "selectedIconPath": "/assets/img/buildSelect.png",        "pagePath": "/pages/index/index",        "text": "淘楼"      },      {        "iconPath": "/assets/img/my.png",        "selectedIconPath": "/assets/img/selectMy.png",        "pagePath": "/pages/my/index",        "text": "我的"      }    ]  },  attached() {},  methods: {    switchTab(e) {      console.log(e.currentTarget)      const data = e.currentTarget.dataset      const url = data.path      wx.switchTab({        url      })      this.setData({        selected: data.index      })    }  }})

json

{  "component": true,  "usingComponents": {}}

wxml

    

上一篇:手臂英文怎么读发音语音?

下一篇:怎么识别是否服务器内存?