breadcrumb.vue 1.28 KB
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<template>
<div class="breadcrumb-wrapper">
    <i class="icon-loc"></i>
    <span class="breadcrumb__item active" @click="goIndex">
        <span>首页</span>
        <i class="el-icon-arrow-right"></i>
    </span>
    <span class="breadcrumb__item">
        <span>{{currentPageName}}</span>
    </span>    
</div>
</template>
<script>
export default {
    data(){
        return{
            currentPageName:''
        }
    },
    mounted(){
        this.currentPageName = this.$route.meta.title
    },
    methods:{
        goIndex(){
            this.$router.push('/index')
        }
    },
    watch:{
        $route() {
          this.currentPageName = this.$route.meta.title
          console.log(this.$route)
      }
    }
}
</script>

<style lang="less" scoped>
.breadcrumb-wrapper{
    width: 100%;
    height: 36px;
    line-height: 36px;
    padding-left: 20px;
    background-color:@party-white;
    .icon-loc{
        display: inline-block;
xulili's avatar
xulili committed
46
        width: 15px;
xulili's avatar
xulili committed
47 48 49
        height: 16px;
        margin-right: 10px;
        vertical-align: middle;
xulili's avatar
xulili committed
50 51
        background: url("~@/assets/login/loc.png") no-repeat;
        background-size: cover;
xulili's avatar
xulili committed
52 53 54 55 56 57 58 59 60 61 62
    }
    .breadcrumb__item{ 
        span{
            color: #151515;
        }
        &.active{
            cursor: pointer;
        }
    }
}
</style>