关于如何自定义tabbar,可以参考官方文档(写的比较详细)
自定义 tabBar | 微信开放文档developers.weixin.qq.com源码如下(参考网上代码,按自己理解做了一些优化)仅供参考
index.js
Component({
data: {
color: "#515151",
selectedColor: "#DAA520",
backgroundColor: "#ffffff",
list: [
{
pagePath: "/pages/index/index",
text: "流水",
iconPath: "/img/income.png",
selectedIconPath: "/img/income-select.png"
},
{
pagePath: "/pages/chart/chart",
text: "图表",
iconPath: "/img/chart.png",
selectedIconPath: "/img/chart-select.png"
},
{
pagePath: "/pages/record/record",
bulge:true,
iconPath: "/img/post.png",
selectedIconPath: "/img/post-select.png"
},
{
pagePath: "/pages/message/message