溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何使用Element NavMenu導(dǎo)航菜單

發(fā)布時(shí)間:2020-07-27 13:53:23 來源:億速云 閱讀:498 作者:小豬 欄目:開發(fā)技術(shù)

這篇文章主要講解了如何使用Element NavMenu導(dǎo)航菜單,內(nèi)容清晰明了,對此有興趣的小伙伴可以學(xué)習(xí)一下,相信大家閱讀完之后會(huì)有幫助。

組件—導(dǎo)航菜單

頂欄

如何使用Element NavMenu導(dǎo)航菜單

<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
 <el-menu-item index="1">處理中心</el-menu-item>
 <el-submenu index="2">
  <template slot="title">我的工作臺(tái)</template>
  <el-menu-item index="2-1">選項(xiàng)1</el-menu-item>
  <el-menu-item index="2-2">選項(xiàng)2</el-menu-item>
  <el-menu-item index="2-3">選項(xiàng)3</el-menu-item>
  <el-submenu index="2-4">
   <template slot="title">選項(xiàng)4</template>
   <el-menu-item index="2-4-1">選項(xiàng)1</el-menu-item>
   <el-menu-item index="2-4-2">選項(xiàng)2</el-menu-item>
   <el-menu-item index="2-4-3">選項(xiàng)3</el-menu-item>
  </el-submenu>
 </el-submenu>
 <el-menu-item index="3" disabled>消息中心</el-menu-item>
 <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">訂單管理</a></el-menu-item>
</el-menu>
<div class="line"></div>
<el-menu
 :default-active="activeIndex2"
 class="el-menu-demo"
 mode="horizontal"
 @select="handleSelect"
 background-color="#545c64"
 text-color="#fff"
 active-text-color="#ffd04b">
 <el-menu-item index="1">處理中心</el-menu-item>
 <el-submenu index="2">
  <template slot="title">我的工作臺(tái)</template>
  <el-menu-item index="2-1">選項(xiàng)1</el-menu-item>
  <el-menu-item index="2-2">選項(xiàng)2</el-menu-item>
  <el-menu-item index="2-3">選項(xiàng)3</el-menu-item>
  <el-submenu index="2-4">
   <template slot="title">選項(xiàng)4</template>
   <el-menu-item index="2-4-1">選項(xiàng)1</el-menu-item>
   <el-menu-item index="2-4-2">選項(xiàng)2</el-menu-item>
   <el-menu-item index="2-4-3">選項(xiàng)3</el-menu-item>
  </el-submenu>
 </el-submenu>
 <el-menu-item index="3" disabled>消息中心</el-menu-item>
 <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">訂單管理</a></el-menu-item>
</el-menu>

<script>
 export default {
  data() {
   return {
    activeIndex: '1',
    activeIndex2: '1'
   };
  },
  methods: {
   handleSelect(key, keyPath) {
    console.log(key, keyPath);
   }
  }
 }
</script>

側(cè)欄

如何使用Element NavMenu導(dǎo)航菜單

<el-row class="tac">
 <el-col :span="12">
  <h6>默認(rèn)顏色</h6>
  <el-menu
   default-active="2"
   class="el-menu-vertical-demo"
   @open="handleOpen"
   @close="handleClose">
   <el-submenu index="1">
    <template slot="title">
     <i class="el-icon-location"></i>
     <span>導(dǎo)航一</span>
    </template>
    <el-menu-item-group>
     <template slot="title">分組一</template>
     <el-menu-item index="1-1">選項(xiàng)1</el-menu-item>
     <el-menu-item index="1-2">選項(xiàng)2</el-menu-item>
    </el-menu-item-group>
    <el-menu-item-group title="分組2">
     <el-menu-item index="1-3">選項(xiàng)3</el-menu-item>
    </el-menu-item-group>
    <el-submenu index="1-4">
     <template slot="title">選項(xiàng)4</template>
     <el-menu-item index="1-4-1">選項(xiàng)1</el-menu-item>
    </el-submenu>
   </el-submenu>
   <el-menu-item index="2">
    <i class="el-icon-menu"></i>
    <span slot="title">導(dǎo)航二</span>
   </el-menu-item>
   <el-menu-item index="3" disabled>
    <i class="el-icon-document"></i>
    <span slot="title">導(dǎo)航三</span>
   </el-menu-item>
   <el-menu-item index="4">
    <i class="el-icon-setting"></i>
    <span slot="title">導(dǎo)航四</span>
   </el-menu-item>
  </el-menu>
 </el-col>
 <el-col :span="12">
  <h6>自定義顏色</h6>
  <el-menu
   default-active="2"
   class="el-menu-vertical-demo"
   @open="handleOpen"
   @close="handleClose"
   background-color="#545c64"
   text-color="#fff"
   active-text-color="#ffd04b">
   <el-submenu index="1">
    <template slot="title">
     <i class="el-icon-location"></i>
     <span>導(dǎo)航一</span>
    </template>
    <el-menu-item-group>
     <template slot="title">分組一</template>
     <el-menu-item index="1-1">選項(xiàng)1</el-menu-item>
     <el-menu-item index="1-2">選項(xiàng)2</el-menu-item>
    </el-menu-item-group>
    <el-menu-item-group title="分組2">
     <el-menu-item index="1-3">選項(xiàng)3</el-menu-item>
    </el-menu-item-group>
    <el-submenu index="1-4">
     <template slot="title">選項(xiàng)4</template>
     <el-menu-item index="1-4-1">選項(xiàng)1</el-menu-item>
    </el-submenu>
   </el-submenu>
   <el-menu-item index="2">
    <i class="el-icon-menu"></i>
    <span slot="title">導(dǎo)航二</span>
   </el-menu-item>
   <el-menu-item index="3" disabled>
    <i class="el-icon-document"></i>
    <span slot="title">導(dǎo)航三</span>
   </el-menu-item>
   <el-menu-item index="4">
    <i class="el-icon-setting"></i>
    <span slot="title">導(dǎo)航四</span>
   </el-menu-item>
  </el-menu>
 </el-col>
</el-row>

<script>
 export default {
  methods: {
   handleOpen(key, keyPath) {
    console.log(key, keyPath);
   },
   handleClose(key, keyPath) {
    console.log(key, keyPath);
   }
  }
 }
</script>

折疊

如何使用Element NavMenu導(dǎo)航菜單

<el-radio-group v-model="isCollapse" >
 <el-radio-button :label="false">展開</el-radio-button>
 <el-radio-button :label="true">收起</el-radio-button>
</el-radio-group>
<el-menu default-active="1-4-1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
 <el-submenu index="1">
  <template slot="title">
   <i class="el-icon-location"></i>
   <span slot="title">導(dǎo)航一</span>
  </template>
  <el-menu-item-group>
   <span slot="title">分組一</span>
   <el-menu-item index="1-1">選項(xiàng)1</el-menu-item>
   <el-menu-item index="1-2">選項(xiàng)2</el-menu-item>
  </el-menu-item-group>
  <el-menu-item-group title="分組2">
   <el-menu-item index="1-3">選項(xiàng)3</el-menu-item>
  </el-menu-item-group>
  <el-submenu index="1-4">
   <span slot="title">選項(xiàng)4</span>
   <el-menu-item index="1-4-1">選項(xiàng)1</el-menu-item>
  </el-submenu>
 </el-submenu>
 <el-menu-item index="2">
  <i class="el-icon-menu"></i>
  <span slot="title">導(dǎo)航二</span>
 </el-menu-item>
 <el-menu-item index="3" disabled>
  <i class="el-icon-document"></i>
  <span slot="title">導(dǎo)航三</span>
 </el-menu-item>
 <el-menu-item index="4">
  <i class="el-icon-setting"></i>
  <span slot="title">導(dǎo)航四</span>
 </el-menu-item>
</el-menu>

<style>
 .el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
 }
</style>

<script>
 export default {
  data() {
   return {
    isCollapse: true
   };
  },
  methods: {
   handleOpen(key, keyPath) {
    console.log(key, keyPath);
   },
   handleClose(key, keyPath) {
    console.log(key, keyPath);
   }
  }
 }
</script>

Menu Attribute

如何使用Element NavMenu導(dǎo)航菜單

如何使用Element NavMenu導(dǎo)航菜單

Menu Methods

如何使用Element NavMenu導(dǎo)航菜單

Menu Events

如何使用Element NavMenu導(dǎo)航菜單

SubMenu Attribute

如何使用Element NavMenu導(dǎo)航菜單

Menu-Item Attribute

如何使用Element NavMenu導(dǎo)航菜單

Menu-Group Attribute

如何使用Element NavMenu導(dǎo)航菜單

看完上述內(nèi)容,是不是對如何使用Element NavMenu導(dǎo)航菜單有進(jìn)一步的了解,如果還想學(xué)習(xí)更多內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI