1.在根目录下创建一个底部导航的文件
2.在底部导航的index.js文件中写入逻辑:
Component({
/**
* 组件的初始数据
*/
data: {
selected: 0,
color: "#00152B",
selectedColor: "#0053A9",
list: [],
},
lifetimes: {
ready: function() {
// 页面被展示
//网格员
const grid = [{
pagePath: "/pages/grid/home",
iconPath: "/static/tabbar/gongzuotai.png",
selectedIconPath: "/static/tabbar/gongzuotai_active.png",
text: "工作台",
},
{
pagePath: "/pages/personal-center/personal-center",
iconPath: "/static/tabbar/gerenzhongxin.png",
selectedIconPath: "/static/tabbar/gerenzhongxin_active.png",
text: "个人中心",
},
];
// 工作人员
const government = [{
pagePath: "/pages/government/home",
iconPath: "/static/t