Menu 导航菜单
Menu 菜单
用于页面导航的菜单列表,建议一次取出全部菜单到前端处理
代码示例
>{}
<template>
<div class="menu-ui-page">
<Menu :data="the.sidebar" @onEvent="onMenuEvent" />
</div>
</template>
<script>
export default {
setup() {
// 使用外挂方式引入,具体查看demo
const $plus = window.$plus;
const reactive = $plus.vue.reactive;
const the = reactive({
sidebar: [
{
icon: 'icon-rili',
path: '/workplace',
title: '工作台',
dot: true,
// 子菜单
children: [
{
icon: 'icon-menu',
path: '/TestTree',
title: '树列表',
},
{
icon: 'icon-menu',
path: '/TestTree',
title: '树列表',
dot: '99',
},
{ icon: 'icon-menu', path: '/TestTree', title: '树列表' },
],
},
{
icon: 'icon-rili',
path: '/home',
title: '首页',
},
],
});
/**
* 菜单点击
*/
const onMenuEvent = (resp) => {
console.log('btnMenu', resp);
switch (resp.cmd) {
case 'click':
break;
}
};
return { the, onMenuEvent };
},
};
</script>
<style lang="less">
.menu-ui-page {
ul,
li {
list-style: none outside none;
}
background-color: #1a202c;
width: 8rem;
.title {
font-size: 0.6rem;
}
}
</style>
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Menu props
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
named 0.4.8 | 组件命名 | String | menu |
| data | 子菜单数据 | Array | - |
Menu events
| 事件名 | 说明 | 返回值 |
|---|---|---|
| onEvent | 点击触发回调事件 | json |
Events cmd click
- 选择子菜单触发
| 参数名 | 说明 | 类型 |
|---|---|---|
named 0.4.8 | 组件命名 | String |
| active | 当前层级 | String |
| item | 当前对象 | Object |
MenuItem props
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| icon | 图标,参考图标库 | String | - |
| path | 路径 | String | - |
| title | 显示文字 | String | - |
| dot | 显示小红点,或者自定义显示内容 | Boolean,String,Number | true |
Quick 文档 0.2.3