Skip to content
目录

SystemMenu系统菜单

注意

侧边栏菜单,用于运营平台系统配置菜单,可配置权限管理。

注册该组件时会自动绑定$getModuleUrl方法到vue 原型上面。 Vue.prototype.$getModuleUrl = (moduleName,op) => {}。 并且会全局混入Vue.mixin全局混入powerList权限属性,powerList具有权限根据moduleName 智能匹配该模块下所配置的所有op值来做权限控制,所以使用方法可在所有组件内直接使用v-if="powerList[op]"控制权限,注意只有配置了 moduleName的组件才能控制权限。 this.$getModuleUrl(moduleName,op)根据moduleNameop值获取对应模块的 请求地址 及 权限

可在页面组件里用this.$getModuleUrl(moduleName,op)根据moduleNameop值获取对应模块的 请求地址 及 权限

基础用法

vue
<template>
    <ws-system-menu :menuData="menuData" :menuConfig="menuConfig"></ws-system-menu>
</template>

<script>
    export default {
        data () {
            return {
                menuData: [],
                menuConfig: {
                    backgroundColor: '#313F5A',
                }
            }
        },
        created () {
            getMenuList().then(res => {
                if (res.code == 1) {
                    this.menuData = JSON.parse(res.data);
                }
            })
        }
    }
</script>

属性

参数说明类型默认值
menuWidth菜单宽度String256px
lineHeight菜单子项高度,行高String48px
fontSize菜单字体大小String14px
inconFontSize菜单字体图标大小String14px
backgroundColor菜单背景颜色String#393f52
textColor菜单字体颜色String#fff
activeTextColor激活选中菜单字体颜色String#fff
activeBackgroundColor激活选中菜单背景颜色String#2B2F42
hoverBackgroundColorhover菜单背景颜色String#2B2F42
hoverTextColorhover菜单字体颜色String#fff
disableTextColor禁用收缩和展开菜单字体颜色,固定降低透明度0.5String#fff
uniqueOpened是否只保持一个子菜单的展开Booleantrue
routerModel是否开启路由模式,路由模式下router作为路由连接,并默认选中打开当前路由对应菜单Booleantrue
defaultActiveId默认激活选中的菜单的id,id优先级高于moduleNameString-
defaultActiveModuleName默认激活选中的菜单的模块名moduleNameString-
indentLevelA一级菜单缩进值String-
indentLevelB二级菜单缩进值String-
indentLevelC三级菜单缩进值String-
toggleLevelA一级菜单是否可收缩Booleanfalse
toggleLevelB二级菜单是否可收缩Booleantrue
toggleLevelC三级菜单是否可收缩Booleantrue

方法

方法名说明
$getModuleUrl绑定到Vue.prototype上,根据模块名和op值查询对应模块的请求地址及权限,参数{moduleName,op}
$getModuleOpList绑定到Vue.prototype上,根据模块名查询当前模块所有配置的op,参数{moduleName}

插槽

name说明
logo项目logo