2016-07-27 14:15:02 +08:00
|
|
|
|
<style>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
.demo-box.demo-menu {
|
|
|
|
|
.el-menu-demo {
|
|
|
|
|
padding-left: 55px;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
}
|
2016-09-01 10:48:06 +08:00
|
|
|
|
.el-menu-vertical-demo {
|
|
|
|
|
width: 200px;
|
|
|
|
|
height: 400px;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
}
|
2016-09-01 10:48:06 +08:00
|
|
|
|
.line {
|
|
|
|
|
height: 1px;
|
|
|
|
|
background-color: #e0e6ed;
|
|
|
|
|
margin: 35px -24px;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
}
|
2016-09-01 10:48:06 +08:00
|
|
|
|
h5 {
|
|
|
|
|
font-size: 14px;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
color: #8492a6;
|
2016-09-01 10:48:06 +08:00
|
|
|
|
margin-top: 10px;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
}
|
2016-09-01 10:48:06 +08:00
|
|
|
|
.tac {
|
|
|
|
|
text-align: center;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
.el-menu-vertical-demo {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
text-align: left;
|
2016-07-27 14:15:02 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
search: '',
|
|
|
|
|
search2: ''
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleopen(key, keyPath) {
|
|
|
|
|
console.log(key, keyPath);
|
|
|
|
|
},
|
|
|
|
|
handleclose(key, keyPath) {
|
|
|
|
|
console.log(key, keyPath);
|
|
|
|
|
},
|
|
|
|
|
handleselect(key, keyPath) {
|
|
|
|
|
console.log(key, keyPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
## NavMenu 导航菜单
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
为网站提供导航功能的菜单
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
### 顶栏
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
适用广泛的基础用法。
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
::: demo
|
2016-07-27 14:15:02 +08:00
|
|
|
|
```html
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu theme="dark" default-active="1" class="el-menu-demo" mode="horizontal" @select="handleselect">
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="1">处理中心</el-menu-item>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-submenu index="2">
|
|
|
|
|
<template slot="title">我的工作台</template>
|
|
|
|
|
<el-menu-item index="2-1">选项1</el-menu-item>
|
|
|
|
|
<el-menu-item index="2-2">选项2</el-menu-item>
|
|
|
|
|
<el-menu-item index="2-3">选项3</el-menu-item>
|
|
|
|
|
</el-submenu>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="3">订单管理</el-menu-item>
|
|
|
|
|
</el-menu>
|
|
|
|
|
<div class="line"></div>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu default-active="1" class="el-menu-demo" mode="horizontal" @select="handleselect">
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="1">处理中心</el-menu-item>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-submenu index="2">
|
|
|
|
|
<template slot="title">我的工作台</template>
|
|
|
|
|
<el-menu-item index="2-1">选项1</el-menu-item>
|
|
|
|
|
<el-menu-item index="2-2">选项2</el-menu-item>
|
|
|
|
|
<el-menu-item index="2-3">选项3</el-menu-item>
|
|
|
|
|
</el-submenu>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="3">订单管理</el-menu-item>
|
|
|
|
|
</el-menu>
|
2016-07-27 14:15:02 +08:00
|
|
|
|
```
|
2016-09-01 10:48:06 +08:00
|
|
|
|
:::
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
### 侧栏
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
垂直菜单,可内嵌子菜单。
|
2016-08-23 10:00:13 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
::: demo
|
2016-08-23 10:00:13 +08:00
|
|
|
|
```html
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-row class="tac">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<h5>带 icon</h5>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu default-active="2" class="el-menu-vertical-demo" @open="handleopen" @close="handleclose">
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-submenu index="1">
|
|
|
|
|
<template slot="title"><i class="el-icon-message"></i>导航一</template>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu-item-group title="分组一">
|
|
|
|
|
<el-menu-item index="1-1">选项1</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-2">选项2</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
|
|
|
|
<el-menu-item-group title="分组2">
|
|
|
|
|
<el-menu-item index="1-3">选项3</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
2016-07-27 14:15:02 +08:00
|
|
|
|
</el-submenu>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="2"><i class="el-icon-menu"></i>导航二</el-menu-item>
|
|
|
|
|
<el-menu-item index="3"><i class="el-icon-setting"></i>导航三</el-menu-item>
|
|
|
|
|
</el-menu>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<h5>不带 icon</h5>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu default-active="2" class="el-menu-vertical-demo" @open="handleopen" @close="handleclose" theme="dark">
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-submenu index="1">
|
|
|
|
|
<template slot="title">导航一</template>
|
2016-09-05 11:30:05 +08:00
|
|
|
|
<el-menu-item-group title="分组一">
|
|
|
|
|
<el-menu-item index="1-1">选项1</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-2">选项2</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
|
|
|
|
<el-menu-item-group title="分组2">
|
|
|
|
|
<el-menu-item index="1-3">选项3</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
2016-07-27 14:15:02 +08:00
|
|
|
|
</el-submenu>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item index="2">导航二</el-menu-item>
|
|
|
|
|
<el-menu-item index="3">导航三</el-menu-item>
|
2016-07-27 14:15:02 +08:00
|
|
|
|
</el-menu>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<h5>分组</h5>
|
|
|
|
|
<el-menu mode="vertical" default-active="1" class="el-menu-vertical-demo">
|
|
|
|
|
<el-menu-item-group title="分组一">
|
|
|
|
|
<el-menu-item index="1"><i class="el-icon-message"></i>导航一</el-menu-item>
|
|
|
|
|
<el-menu-item index="2"><i class="el-icon-message"></i>导航二</el-menu-item>
|
2016-08-23 10:00:13 +08:00
|
|
|
|
</el-menu-item-group>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
<el-menu-item-group title="分组二">
|
|
|
|
|
<el-menu-item index="3"><i class="el-icon-message"></i>导航三</el-menu-item>
|
|
|
|
|
<el-menu-item index="4"><i class="el-icon-message"></i>导航四</el-menu-item>
|
|
|
|
|
<!-- <el-submenu index="5">
|
|
|
|
|
<template slot="title">导航五</template>
|
|
|
|
|
<el-menu-item-group title="分组一">
|
|
|
|
|
<el-menu-item index="5-1">选项1</el-menu-item>
|
|
|
|
|
<el-menu-item index="5-2">选项2</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
|
|
|
|
<el-menu-item-group title="分组二">
|
|
|
|
|
<el-menu-item index="5-3">选项3</el-menu-item>
|
|
|
|
|
</el-menu-item-group>
|
|
|
|
|
</el-submenu> -->
|
2016-08-23 10:00:13 +08:00
|
|
|
|
</el-menu-item-group>
|
2016-09-01 10:48:06 +08:00
|
|
|
|
</el-menu>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2016-07-27 14:15:02 +08:00
|
|
|
|
```
|
2016-09-01 10:48:06 +08:00
|
|
|
|
:::
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
### Menu Attribute
|
2016-07-27 14:15:02 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
|---------- |-------- |---------- |------------- |-------- |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| mode | 模式 | string | horizontal,vertical | vertical |
|
2016-07-27 14:15:02 +08:00
|
|
|
|
| theme | 主题色 | string | light,dark | light |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| default-active | 当前激活菜单的 index | string | — | — |
|
2016-09-01 10:48:06 +08:00
|
|
|
|
| default-openeds | 当前打开的submenu的 key 数组 | Array | — | — |
|
|
|
|
|
| unique-opend | 是否只保持一个子菜单的展开 | boolean | — | false |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| router | 是否使用 vue-router 的模式,启用该模式会在激活导航时以 index 作为 path 进行路由跳转 | boolean | — | false |
|
2016-09-01 10:48:06 +08:00
|
|
|
|
|
|
|
|
|
### Menu Events
|
|
|
|
|
| 事件名称 | 说明 | 回调参数 |
|
|
|
|
|
|---------- |-------- |---------- |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| select | 菜单激活回调 | index: 选中菜单项的 indexPath: 选中菜单项的 index path |
|
|
|
|
|
| open | SubMenu 展开的回调 | index: 打开的 subMenu 的 index, indexPath: 打开的 subMenu 的 index path |
|
|
|
|
|
| close | SubMenu 收起的回调 | index: 收起的 subMenu 的 index, indexPath: 收起的 subMenu 的 index path |
|
2016-09-01 10:48:06 +08:00
|
|
|
|
|
|
|
|
|
### SubMenu Attribute
|
2016-07-27 14:15:02 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
|---------- |-------- |---------- |------------- |-------- |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| index | 唯一标志 | string | — | — |
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
### Menu-Item Attribute
|
2016-07-27 14:15:02 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
|---------- |-------- |---------- |------------- |-------- |
|
2016-09-05 11:30:05 +08:00
|
|
|
|
| index | 唯一标志 | string | — | — |
|
2016-08-23 10:00:13 +08:00
|
|
|
|
|
2016-09-01 10:48:06 +08:00
|
|
|
|
### Menu-Group Attribute
|
2016-08-23 10:00:13 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
|---------- |-------- |---------- |------------- |-------- |
|
2016-09-01 10:48:06 +08:00
|
|
|
|
| title | 分组标题 | string | — | — |
|