更新记录

1.0.0(2023-09-26)

底部自定义tabbar标签菜单导航栏支持凸起效果(支持小程序和H5)


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
× × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × ×

tabBar Props

属性名 类型 默认值 说明
items Array [] tab数据,传值见代码示例
currentIndex Number 0 当前tab页面的索引,根据items数组的位置来决定当前页面该传什么值
color String #7A7E83 tab 上的文字默认颜色
selectedColor String #c1a400 tab 上的文字选中时的颜色
borderStyle String #eee tabbar 上边框的颜色
backgroundColor String #fff tab 的背景色
fontSize String 28rpx 文字默认大小

tabBar 示例

<template>  
  <view>  
        <view>首页</view>
        <custom-tab-bar :items="tabItems" :currentIndex="currentTab" @item-click="onTabClick"
        :color="color" :selectedColor="selectedColor"></custom-tab-bar>
  </view>  
</template>  

<script>  
import CustomTabBar from '@/uni_modules/niceui-tabBar/components/niceui-tabBar/niceui-tabBar.vue';  
import tabbar from '@/uni_modules/niceui-tabBar/common/tabbar.js'
export default {  
  components: {  
    CustomTabBar  
  },  
  data() {  
    return {  
        currentTab: 0, // 当前选中的tab索引  
        tabItems:tabbar.tabItems,
        color:tabbar.color,
        selectedColor:tabbar.selectedColor
    }
  },
  methods: {  
     onTabClick(index) { // 切换tab的函数,当选中某个tab时触发  
       //this.currentTab = index;  
       if(index!=this.currentTab){
            uni.redirectTo({
                url:this.tabItems[index].pagePath
            })
       }
     }  
   }  
};  
</script>

tabbar.js

//pagePath以自己项目的实际路径为准,这里是为了代码聚合在一起
const tabbar = {
    "tabItems":[
        {
            "pagePath": "/uni_modules/niceui-tabBar/pages/index/index",
            "icon": '/static/images/tabbar/index.png', 
            "selectedIcon":'/static/images/tabbar/index-action.png', 
            "text": '首页',
        },
        {
            "pagePath": "/uni_modules/niceui-tabBar/pages/add/add",
            "icon": '/static/images/tabbar/add.png', 
            "selectedIcon":'/static/images/tabbar/add-action.png', 
            "text": '新建',
            "up":true
        },
        { 
            "pagePath": "/uni_modules/niceui-tabBar/pages/user/user",
            "icon": '/static/images/tabbar/me.png', 
            "selectedIcon":'/static/images/tabbar/me-action.png', 
            "text": '我的',
        }
    ],
    "color":"#333",
    "selectedColor":"green",
}
export default tabbar

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问