国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Element -Ui之NavMenu導(dǎo)航欄

這篇具有很好參考價(jià)值的文章主要介紹了Element -Ui之NavMenu導(dǎo)航欄。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

一、NavMenu重要標(biāo)簽和參數(shù)說明

  • mode:導(dǎo)航欄的模式,默認(rèn)值vertical 導(dǎo)航欄處于垂直狀態(tài),改為horizonta可變?yōu)樗侥J健?/p>

  • index:唯一標(biāo)志。

  • default-active:激活當(dāng)前菜單的index。

  • router: 是否使用路由,啟用后可以通過index作為地址進(jìn)行跳轉(zhuǎn)。

  • <el-menu-item index="1">導(dǎo)航欄中的子菜單標(biāo)簽。

  • <el-submenu> 生成二級(jí)菜單。

代碼實(shí)現(xiàn):

<template>
<el-menu
      :default-active="path"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      text-color="black"
      background-color="white"
      active-text-color="#31c27c"
      router
    >
    <el-menu-item index="1">一</el-menu-item>
    <el-menu-item index="2">二</el-menu-item>
    <el-menu-item index="3">三</el-menu-item>
    <!-- 添加二級(jí)菜單 -->
    <el-submenu index="4"> 
        <template slot="title">四</template>
        <el-menu-item index="4-1">4.1</el-menu-item>
        <el-menu-item index="4-2">4.2</el-menu-item>
        <el-menu-item index="4-3">4.3</el-menu-item>
    </el-submenu>
    </el-menu>
</template>

二、導(dǎo)航菜單中的router用法

router默認(rèn)值為false需要激活來啟用。

<el-menu router="true"></el-menu>

其中,index的值作為地址進(jìn)行跳轉(zhuǎn)。

案例:

<template>
  <div>
    <el-menu
      :default-active="path"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      text-color="black"
      background-color="white"
      active-text-color="#31c27c"
      router
    >
       <el-menu-item>
        <img
          src=""
          alt=""
        />
      </el-menu-item>
        <!-- 使用v-for循環(huán)添加子菜單 -->
      <template v-for="(item, index) in nav_menu_data">
        <el-menu-item :index="item.path" :key="index">
          {{ item.title }}
        </el-menu-item>
      </template> 

      <!-- 登錄與退出按鈕 -->
      <!-- 從服務(wù)端搜索數(shù)據(jù) -->
      <el-autocomplete
        v-model="state"
        :fetch-suggestions="querySearchAsync"
        placeholder="搜索音樂、歌單、MV"
        @select="handleSelect"
        class="search"
        suffix-icon="el-icon-search"
      ></el-autocomplete>
      <el-button type="text" class="btn_login">登錄</el-button>
    </el-menu>
</div>
</template>

<script>
  export default {
  name: "NavMenu",
  data() {
    return {
      path: "",
      nav_menu_data: [
        {
          title: "發(fā)現(xiàn)音樂",
          path: "/home/faxian",
        },
        {
          title: "我的音樂",
          path: "/Menu/Page2",
        },
        {
          title: "關(guān)注",
          path: "/home/guanzhu",
        },
        {
          title: "分類",
          path: "/Menu/Page4",
        },
      ],
      activeIndex: "1",
    };
  },
  created() {
    this.onRouteChanged();
  },
  watch: {
    $route: "onRouteChanged",
  },
  methods: {
    onRouteChanged() {
      let that = this;
      that.path = that.$route.path;
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
<style lang="less" scoped>
</style>

效果圖:

elementui導(dǎo)航欄菜單,elementui,vue.js,javascript文章來源地址http://www.zghlxwxcb.cn/news/detail-632475.html

到了這里,關(guān)于Element -Ui之NavMenu導(dǎo)航欄的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包