uniapp设置tabBar跳转后,其他页面跳转到主页(整理)

"tabBar": {
    
    
	// #ifdefAPP-PLUS
	// tabbar 上边框的颜色
	// "borderStyle": "#fd65f8",
	// #endif
	// tab 上的文字默认颜色
	"color": "#222222",
	// tab 上的文字选中时的颜色
	"selectedColor": "#F21177",
	// tab 的背景色
	"backgroundColor": "#ffffff",
	"list": [{
    
    
		"pagePath": "pages/home/index",
		"text": "首页",
		"iconPath": "static/nav/icon_home_n.png",
		"selectedIconPath": "static/nav/icon_home_s.png"
	}, {
    
    
		"pagePath": "pages/home/localityIndex",
		"text": "本地生活",
		"iconPath": "static/nav/icon_bdsh_n.png",
		"selectedIconPath": "static/nav/icon_bdsh_s.png"
	}, {
    
    
		"pagePath": "pages/home/orderIndex",
		"text": "订单",
		"iconPath": "static/nav/icon_dd_n.png",
		"selectedIconPath": "static/nav/icon_dd_s.png"
	}, {
    
    
		"pagePath": "pages/home/myIndex",
		"text": "我的",
		"iconPath": "static/nav/icon_me_n.png",
		"selectedIconPath": "static/nav/icon_me_s.png"
	}],
	"permission": {
    
    
		"scope.userLocation": {
    
    
			"desc": "你的位置信息将用于小程序位置接口的效果展示"
		}
	}
},
那么对应的4个页面就都会出现tabBar,如果想要通过代码跳转到这几个页面,比如进入到某个子页面后,想返回到首页,需要使用switchTab

uni.switchTab({
    
    
	url: '/pages/home/index'
})

猜你喜欢

转载自blog.csdn.net/qq_38881495/article/details/125910504
今日推荐