navbar.vue 942 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div class="banner">
  3. <el-menu class="nav-menu" mode="horizontal" background-color="#20a0ff" text-color="#fff" active-text-color="#ffd04b">
  4. <naf-menu-item
  5. v-for="(item, idx) in menuItems"
  6. :key="idx"
  7. :index="idx.toString()"
  8. :title="item.title"
  9. :options="item.options"
  10. :children="item.children"
  11. :target="item.target"
  12. :prefix="routerPrefix"
  13. >
  14. </naf-menu-item>
  15. </el-menu>
  16. <naf-user />
  17. </div>
  18. </template>
  19. <script>
  20. import NafMenuItem from '../menu-item';
  21. import NafUser from './user';
  22. export default {
  23. components: {
  24. NafMenuItem,
  25. NafUser,
  26. },
  27. props: {
  28. menuItems: Array,
  29. routerPrefix: { type: String, default: '' },
  30. },
  31. };
  32. </script>
  33. <style lang="less" scoped>
  34. .banner {
  35. flex: 1;
  36. display: flex;
  37. flex-direction: row;
  38. align-items: center;
  39. padding: 0 20px;
  40. }
  41. .nav-menu {
  42. flex: 1;
  43. border-bottom: 0;
  44. }
  45. </style>