demo5.vue 1.5 KB

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