
JS
(1)tabBar相关属性 color:tab上的文字默认颜色,仅支持十六进制颜色。 selectedColor:tab上的文字选中时的颜色,仅支持十六进制颜色。 backgroundColor:tab的背景色,仅支持十六进制颜色。 borderStyle:tabbar上边框的颜色, 仅支持 black / white。 position:tabBar的位置,默认值是: bottom,仅支持 bottom / top。当 position 为 top 时,不显示 icon。 custom:自定义tabBar。 tabBar:{ color:#000000, selectedColor:#336699, backgroundColor:#ffffff, borderStyle:black, position:bottom } (2)list list:tab的列表。 list 接受一个数组,只能配置最少 2 个、最多 5 个 tab。 pagePath:页面路径,必须在pages 中先定义。 text:tab 上按钮文字。 iconPath:图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。selectedIconPath:选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 list:[ { text:首页, pagePath:pages/index/index, iconPath:assets/icon/home.png, selectedIconPath:assets/icon/home2.png }, { text:列表, pagePath:pages/list/list, iconPath:assets/icon/list.png, selectedIconPath:assets/icon/list2.png } ] 2、页面跳转 (1)跳转普通页面 方法① navigator组件 !--跳转到普通页,可以通过返回按钮返回-- navigatorurl=../detAIl/detAIl到详情页/navigator 方法② navigateTo()方法 navigateTo()方法,用于跳转普通页面。 viewbindtap=gotoDetAIl到详情页/view
gotoDetAIl(){ //使用全局api跳转,navigateTo()方法,用于跳转普通页面 wx.navigateTo({ url:'../detAIl/detAIl', }) } (2)跳转tabBar页面 方法① navigator组件 如果要使用navigator组件跳转tabBar页面,需要设置open-type=switchTab。 !--跳转到tabBar页面,不可以通过返回按钮返回。因为跳转到指定的tabBar页面后,会关闭其他所有页面-- navigatorurl=../list/listopen-type=switchTab到列表页/navigator 方法② switchTab()方法 switchTab()方法,用于跳转tabBar页面。

客户端
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号