赞
踩
// 需要先定义tabBar页面 // “pages” 配置里面也不要忘了 "tabBar": { "custom": true, "list": [ { "pagePath": "pages/index/index" }, { "pagePath": "pages/goods/index" }, { "pagePath": "pages/add/index" }, { "pagePath": "pages/shop/index" }, { "pagePath": "pages/my/index" } ] }
// app.js App({ //定义全局setTabbar方法 $setTabbar(that,currentName){ if(typeof that.getTabBar == 'function' && that.getTabBar()){ let tabbar = that.getTabBar(); console.log(tabbar); tabbar.setData({ currentName }) } }, onLaunch() { }, globalData: { } })
Page({
/**
* 页面的初始数据
*/
data
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。