vue写能展开的面包屑导航

<template>

  <div class="breadcrumb" tabindex="0" hidefocus="true">

    <div

      v-for="(item, key, index) in NavigationList"

      :key="index"

      class="Secondary_navigation_box"

    >

      <div

        class="Secondary_navigation"

        :class="{ first_click: activeFirst === key }"

        @click="firstClick(item, key)"

      >

        {{ item.firstNavigation }}

      </div>

      <div

        v-show="activeFirst === key && item.children"

        class="Secondary_navigation_pops"

      >

        <ul class="navigation_pops">

          <li

            v-for="(value, sIndex) in item.children"

            :key="sIndex"

            :class="{ click_style: activatingRows === sIndex }"

            @click="changeListStyle(value, sIndex)"

          >

            <span>{{ value }}</span>

          </li>

        </ul>

      </div>

    </div>

  </div>

</template>

<script>

export default {

  name: 'BreadCrum',

  data () {

    return {

      // 一级导航激活

      activeFirst: false,

      // 二级导航弹出框开关

      NavigationPops: false,

      // 当前激活

      activatingRows: 0,

      firstNavigation: ['Ych jp', 'Gtegd', 'Tbnk', 'Tsmgzggf', 'Qunyewo'],

      secondaryNavigationList: ['Ideew Ygwmay', 'Jipdkjj tkyv'],

      NavigationList: [

        { firstNavigation: 'Ych jp' },

        {

          firstNavigation: 'Gtegd',

          children: ['Ideew Ygwmay', 'Jipdkjj tkyv']

        },

        { firstNavigation: 'Tbnk' },

        { firstNavigation: 'Tsmgzggf' },

        { firstNavigation: 'Qunyewo' }

      ]

    }

  },

  methods: {

    changeListStyle (item, index) {

      this.activatingRows = index

    },

    firstClick (item, key) {

      this.NavigationPops = !this.NavigationPops

      // console.log(key)

      this.activeFirst = key

    }

  }

}

</script>

<style lang="less" scoped>

/*面包屑盒子*/

.breadcrumb {

  display: flex;

  margin-left: 20px;

  margin-top: 10px;

  margin-bottom: 10px;

}

/*面包屑项*/

.breadcrumb-item {

  position: relative;

  // width: 160px;

  height: 40px;

  background-image: linear-gradient(270deg, #d8d8d8 0%, #eeeeee 100%);

  font-family: Manrope-Medium;

  font-size: 16px;

  color: #191919;

  line-height: 40px;

  text-align: center;

  padding: 0 40px 0 40px;

}

.breadcrumb-item::after {

  border-top: 20px solid transparent;

  border-bottom: 20px solid transparent;

  border-left: 20px solid #d8d8d8;

  content: '';

  width: 0;

  position: absolute;

  right: -20px;

  z-index: 2;

}

.first_click {

  background: #826df0;

  font-family: Manrope-Bold;

  font-size: 16px;

  color: #ffffff !important;

  background-image: none !important;

}

.first_click::after {

  border-left: 20px solid #826df0 !important;

}

// 二级导航盒子

.Secondary_navigation_box {

  display: flex;

  font-family: Manrope-Bold;

}

// 二级导航--主按钮

.Secondary_navigation {

  position: relative;

  // width: 160px;

  height: 40px;

  background-image: linear-gradient(270deg, #d8d8d8 0%, #eeeeee 100%);

  font-family: Manrope-Medium;

  font-size: 16px;

  color: #191919;

  line-height: 40px;

  text-align: center;

  padding: 0 40px 0 40px;

}

// 主按钮--三角形

.Secondary_navigation::after {

  border-top: 20px solid transparent;

  border-bottom: 20px solid transparent;

  border-left: 20px solid #d8d8d8;

  content: '';

  width: 0;

  position: absolute;

  right: -20px;

  z-index: 2;

}

// 二级弹导航弹出框

.Secondary_navigation_pops {

  // width: 100%;

  box-sizing: border-box;

  height: 40px;

  background: #fff;

  position: relative;

  display: flex;

  align-items: center;

  border-top: 1px solid #979797;

  border-bottom: 1px solid #979797;

  // 弹出框子元素

  .navigation_pops {

    display: flex;

    list-style: none;

    li {

      margin-right: 23px;

    }

    .click_style {

      color: #6235f7;

    }

    span {

      line-height: 40px;

    }

  }

}

.Secondary_navigation_pops::after {

  border-top: 20px solid transparent;

  border-bottom: 20px solid transparent;

  border-left: 20px solid #fff;

  content: '';

  width: 0;

  position: absolute;

  right: -20px;

  z-index: 2;

}

</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值