0

    解决微信小程序获取自定义tabbar的高度总是为0的问题

    2023.08.06 | admin | 140次围观

    要自定义微信小程序的 tabbar,你需要在小程序的配置文件 `app.json` 中进行设置。在 `app.json` 中,你需要在 "tabBar" 字段下定义你的 tabbar。例如:```{ "tabBar": {"color": "#000000","selectedColor": "#0f87ff","backgroundColor": "#ffffff","list": [{"pagePath": "index","text": "首页","iconPath": "assets/images/home.png","selectedIconPath": "assets/images/home_selected.png"},{"pagePath": "my","text": "我的","iconPath": "assets/images/user.png","selectedIconPath": "assets/images/user_selected.png"}] }}```你可以在 "tabBar" 下的 "list" 字段中定义你的 tabbar 项目。每一个项目都有以下属性:- `pagePath`:对应页面的路径。- `text`:tabbar 上显示的文字。- `iconPath`:tabbar 上的图标路径。- `selectedIconPath`:tabbar 上选中状态的图标路径。你还可以在 "tabBar" 字段下设置其他属性来控制 tabbar 的外观。例如微信小程序tabbar高度,你可以设置 `color` 和 `selectedColor` 属性来控制 tabbar 上文字的颜色微信小程序tabbar高度,设置 `backgroundColor` 属性来控制 tabbar 的背景颜色等。希望这个答案能帮到你!

    版权声明

    本文仅代表作者观点。
    本文系作者授权发表,未经许可,不得转载。

    发表评论