index.vue 1.57 KB
<template>
  <div>
    <el-menu router :default-active="activeMenu" mode="horizontal">
      <!-- 权限菜单 -->
      <!-- <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> -->
      <!-- 菜单全部展示 -->
      <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" />
    </el-menu>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import { asyncRoutes1 } from '@/router'
export default {
  components: { SidebarItem, Logo },
  computed: {
    ...mapGetters(['permission_routes', 'sidebar']),
    activeMenu () {
      const route = this.$route
      const { meta, path } = route
      if (meta.activeMenu) {
        return meta.activeMenu
      }
      return path
    },
    variables () {
      return variables
    },
    asyncRoutes () {
      return asyncRoutes1
    }
  }
}
</script>
<style scoped lang="scss">
.el-menu--horizontal {
  display: flex;
  background: none !important;
}

/deep/.el-menu-item {
  color: #fff;
  font-size: 18px;
}

/deep/.el-menu-item:hover {
  background: none;
  font-weight: 700;
  color: #fff !important;
}

/deep/.el-submenu__title {
  color: #fff;
  font-size: 18px;
}

/deep/.el-submenu__title:hover {
  background: none;
  font-weight: 700;
  font-size: 20px;
}

/deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
  background: none;
  color: #fff;
  font-size: 20px;
  font-weight: 700 !important;
}
</style>