这是小程序的自定义tabbar点击到新建的时候弹出一个组件 待办点击到新建 待办的底层页面不动 在待办的上方弹出组件 首页点击到新建 首页的底层页面不动 在首页的上方弹出组件。代码如下
// 引入全局函数
const app = getApp()
Component({
/**
* 组件的初始数据
*/
data: {
selected: 0,
color: "#afafaf",
selectedColor: "#0099f6",
backgroundColor: "#F7F8F8",
list: [{
"pagePath": "/pages/Workstation/index/index",
"text": "首页",
"iconPath": "../static/images/home.png",
"selectedIconPath": "../static/images/homese.png"
},
{
"pagePath": "/pages/Statistics/Statistics",
"text": "统计",
"iconPath": "../static/images/static.png",
"selectedIconPath": "../static/images/staticse.png"
},
{
"pagePath": "/pages/staticOrder/staticOrder",
bulge:true,
"text": "新建",
"iconPath": "../static/images/newse.png",
"selectedIconPath": "../static/images/newse.png"
},
{
"pagePath": "/pages/index2/index2",
"text": "待办",
"iconPath": "../static/images/workstation.png",
"selectedIconPath": "../static/images/homese.png"
},
{
"pagePath": "/pages/mine/mine",
"text": "我的",
"iconPath": "../static/images/mine.png",
"selectedIconPath": "../static/images/minese.png"
}
]
},
ready: function () {
this.setData({
selected: app.globalData.selected
})
},
/**
* 组件的方法列表
*/
methods: {
switchTab(e) {
// console.log(e);
const data = e.currentTarget.dataset;
const url = data.path;
app.globalData.selected = data.index;
wx.switchTab({
url
})
}
},
})
去自定义底部导航 https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html