欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue+element-ui實(shí)現(xiàn)頭部導(dǎo)航欄組件

 更新時(shí)間:2021年09月27日 11:46:46   作者:彼岸花~黎  
這篇文章主要為大家詳細(xì)介紹了vue+element-ui實(shí)現(xiàn)頭部導(dǎo)航欄組件,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue+element-ui實(shí)現(xiàn)頭部導(dǎo)航欄組件具體代碼,供大家參考,具體內(nèi)容如下

話不多說,先上一張效果圖:

這是一個(gè)頭部導(dǎo)航欄,網(wǎng)站最常見的一個(gè)功能,鼠標(biāo)點(diǎn)擊切換不同界面,樣式跟隨。
首先就是下載element-ui框架

npm install element-ui

在main.js文件里面全局引入這個(gè)ui框架

然后就是在app.vue文件里面注冊(cè)這個(gè)top組件

這是用vue和“餓了么”來實(shí)現(xiàn)的頭部導(dǎo)航欄,看一下代碼:

<template>
  <div class="header">
    <div class="img">
      <img src="@/assets/image/index/logo.png" alt="">
    </div>
    <el-menu
      :default-active="this.$route.path"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      router
      background-color="#fff"
      text-color="#333"
      active-text-color="#0084ff"
      style="flex:1"
    >
      <el-menu-item v-for="(item, i) in navList" :key="i" :index="item.name">
        <template slot="title">
          <span> {{ item.navItem }}</span>
        </template>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
    data() {
    return {
        navList:[
            {name:'/home', navItem:'首頁(yè)'},
            {name:'/home/classRoom',navItem:'我的班級(jí)'},
            {name:'/home/course',navItem:'我的課程'},
            {name:'/home/exam',navItem:'創(chuàng)建考試'},
            {name:'/home/practice',navItem:'創(chuàng)建練習(xí)'},
        ]
                      
    }
  },
  methods: {
    handleSelect(key, keyPath) {
      }
  }
}
</script>

<style>
.el-menu-item{
  font-size: 18px !important;
}
.el-menu-item.is-active {
    color: #ea5b2c !important;
    font-size: 18px !important;
}
.el-menu--horizontal>.el-menu-item.is-active {
  border-bottom: 2px solid #ea5b2c !important;
}
</style>
<style lang="scss" scoped>
.header {
  display: flex;
  width: 100%;
  .img {
    background: #ffffff;
    border-bottom: solid 1px #e6e6e6;
    img {
      height:50px;
      padding:10px;
    }
  }
}
</style>

能力有限,寫的不好的地方還望路過的大佬指點(diǎn)一二。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論