加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
app.js.bak 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
王志 提交于 2021-12-27 11:12 . 代码
//app.js
App({
globalData:{
},
onLaunch: function () {
//云开发环境初始化
wx.cloud.init({
env: "l1-0ggt73w13408e7dd"
})
//隐藏系统tabbar
// wx.hideTabBar();
//获取设备信息
this.getSystemInfo();
},
onShow: function () {
//隐藏系统tabbar
// wx.hideTabBar();
},
getSystemInfo: function () {
let t = this;
wx.getSystemInfo({
success: function (res) {
t.globalData.systemInfo = res;
}
});
},
editTabbar: function () {
let tabbar = this.globalData.tabBar;
let currentPages = getCurrentPages();
let _this = currentPages[currentPages.length - 1];
let pagePath = _this.route;
(pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
for (let i in tabbar.list) {
tabbar.list[i].selected = false;
(tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);
}
_this.setData({
tabbar: tabbar
});
},
globalData: {
systemInfo: null,//客户端设备信息
tabBar: {
"custom": true,
"backgroundColor": "#ffffff",
"color": "#979795",
"selectedColor": "#1c1c1b",
"list": [
{
"pagePath": "/miniprogram/pages/index/index",
"iconPath": "icon/home.png",
"selectedIconPath": "icon/home-o.png",
"text": "首页"
},
{
"pagePath": "/miniprogram/pages/neighborCircle/index",
"iconPath": "icon/circle.png",
"selectedIconPath": "icon/circle-o.png",
"text": "邻聚圈"
},
{
"pagePath": "/miniprogram/pages/middle/middle",
"iconPath": "icon/add.png",
"isSpecial": true,
"text": "发布"
},
{
"pagePath": "/miniprogram/pages/CommunityAid/index",
"iconPath": "icon/aid.png",
"selectedIconPath": "icon/aid-o.png",
"text": "社区互助"
},
{
"pagePath": "/miniprogram/pages/mine/mine",
"iconPath": "icon/my.png",
"selectedIconPath": "icon/my-o.png",
"text": "我的"
}
]
}
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化