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
属性说明类型默认值
named 0.4.8组件命名Stringmenu
data子菜单数据Array-
事件名说明返回值
onEvent点击触发回调事件json

Events cmd click

  • 选择子菜单触发
参数名说明类型
named 0.4.8组件命名String
active当前层级String
item当前对象Object
属性说明类型默认值
icon图标,参考图标库String-
path路径String-
title显示文字String-
dot显示小红点,或者自定义显示内容Boolean,String,Numbertrue

Last Updated: