demo3.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <m-menu mode="horizontal" default-active="1" :theme="theme">
  3. <m-menu-item name="1">菜单一</m-menu-item>
  4. <m-menu-item name="2">菜单二</m-menu-item>
  5. <m-submenu name="3">
  6. <template #title>菜单三</template>
  7. <m-menu-group title="分组一">
  8. <m-menu-item name="3-1">item1</m-menu-item>
  9. <m-menu-item name="3-2">item2</m-menu-item>
  10. <m-menu-item name="3-3">item3</m-menu-item>
  11. </m-menu-group>
  12. <m-menu-group title="分组二">
  13. <m-menu-item name="3-4">item4</m-menu-item>
  14. <m-menu-item name="3-5">item5</m-menu-item>
  15. <m-menu-item name="3-6">item6</m-menu-item>
  16. </m-menu-group>
  17. </m-submenu>
  18. <m-menu-item name="4">菜单四</m-menu-item>
  19. </m-menu>
  20. <m-menu class="mt-50" default-active="1" :theme="theme">
  21. <m-menu-item name="1">菜单一</m-menu-item>
  22. <m-menu-item name="2">菜单二</m-menu-item>
  23. <m-submenu name="3">
  24. <template #title>菜单三</template>
  25. <m-menu-group title="分组一">
  26. <m-menu-item name="3-1">item1</m-menu-item>
  27. <m-menu-item name="3-2">item2</m-menu-item>
  28. <m-menu-item name="3-3">item3</m-menu-item>
  29. </m-menu-group>
  30. <m-menu-group title="分组二">
  31. <m-menu-item name="3-4">item4</m-menu-item>
  32. <m-menu-item name="3-5">item5</m-menu-item>
  33. <m-menu-item name="3-6">item6</m-menu-item>
  34. </m-menu-group>
  35. </m-submenu>
  36. <m-menu-item name="4">菜单四</m-menu-item>
  37. </m-menu>
  38. <div class="theme-style">
  39. <p class="title">切换主题</p>
  40. <m-radio-group v-model="theme">
  41. <m-radio label="light">light</m-radio>
  42. <m-radio label="dark">dark</m-radio>
  43. </m-radio-group>
  44. </div>
  45. </template>
  46. <script setup>
  47. import { ref } from 'vue-demi'
  48. const theme = ref('light')
  49. </script>
  50. <style scoped>
  51. .theme-style{
  52. margin-top: 20px;
  53. }
  54. .title{
  55. margin: 5px;
  56. font-size: 14px;
  57. }
  58. .mt-50{
  59. margin-top: 50px;
  60. }
  61. </style>