uniapp自定义底部导航

我这边使用的是uview组件库,进行开发的!

html 复制代码
<template>
  <view class="footer-bar">
    <u-tabbar :value="select ? select : 0" @change="changeTab" :border="true" :fixed="true" :placeholder="true"
      activeColor="#d81e06" :safeAreaInsetBottom="false">
      <u-tabbar-item :text="item.title" v-for="(item, index) in footerBarList" :key="index">
        <image class="u-page__item__slot-icon" slot="active-icon" :src="item.select_img"></image>
        <image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.img"></image>
      </u-tabbar-item>
    </u-tabbar>
  </view>
</template>

<script>
export default {
  name: "FooterBar",
  data() {
    return {
      select: 0,
      footerBarList: [
        {
          img: "/static/home.png",
          select_img: "/static/home_select.png",
          pagePath: "pages/home/home",
          title: "首页",
        },
        {
          img: "/static/dai_ban.png",
          select_img: "/static/dai_ban_select.png",
          pagePath: "pages/treatTackle/treatTackle",
          title: "待办",
        },
        {
          img: "/static/mine.png",
          select_img: "/static/mine_select.png",
          pagePath: "pages/mine/mine",
          title: "我的",
        },
      ],
    };
  },
  methods: {
    changeTab(index, name) {
      console.log(index);
      uni.switchTab({
        url: "/" + this.footerBarList[index].pagePath,
      });
    },
  },
};
</script>

<style lang="scss"></style>

效果图:

相关推荐
brzhang5 分钟前
代码即图表:dbdiagram.io让数据库建模变得简单高效
前端·后端·架构
三巧16 分钟前
纯CSS吃豆人(JS仅控制进度)
javascript·css·html
SummerGao.17 分钟前
【解决】layui layer的提示框,弹出框一闪而过的问题
前端·layui
软件技术NINI33 分钟前
html css js网页制作成品——HTML+CSS+js美甲店网页设计(5页)附源码
javascript·css·html
天天扭码1 小时前
从数组到对象:JavaScript 遍历语法全解析(ES5 到 ES6 + 超详细指南)
前端·javascript·面试
拉不动的猪1 小时前
前端开发中常见的数据结构优化问题
前端·javascript·面试
街尾杂货店&1 小时前
css word
前端·css
Мартин.1 小时前
[Meachines] [Hard] CrimeStoppers LFI+ZIP-Shell+Firefox-Dec+DLINK+rootme-0.5
前端·firefox
冰镇生鲜1 小时前
快速静态界面 MDC规则约束 示范
前端
技术与健康1 小时前
【解读】Chrome 浏览器实验性功能全景
前端·chrome