cwg-submenu.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="cwg-submenu">
  3. <view class="cwg-submenu-title">
  4. <text>
  5. CWG Markets
  6. </text>
  7. </view>
  8. <view class="submenu">
  9. <view class="cwg-submenu-item" v-for="item in items" :key="item.key" @click="handleClick(item)">
  10. <text>{{ item.label }}</text>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script lang="ts" setup>
  16. interface MenuItem {
  17. key: string;
  18. label: string;
  19. icon?: string;
  20. children?: MenuItem[];
  21. }
  22. const props = defineProps<{ items: MenuItem[] }>();
  23. const emit = defineEmits(['submenu-click']);
  24. function handleClick(item: MenuItem) {
  25. emit('submenu-click', item);
  26. }
  27. </script>
  28. <style scoped lang="scss">
  29. @import "@/uni.scss";
  30. .cwg-submenu {
  31. background: #fff;
  32. position: relative;
  33. z-index: 11;
  34. padding: 0;
  35. margin: 0;
  36. box-shadow: 4px 0 12px rgba(15, 23, 43, 0.08);
  37. border-left: 1px solid #E2E8F0;
  38. .cwg-submenu-title {
  39. padding: 20px;
  40. font-size: 16px;
  41. font-weight: 700;
  42. border-bottom: 1px solid #E2E8F0;
  43. color: #0F172B;
  44. }
  45. .submenu {
  46. margin: 0 px2rpx(20);
  47. width: px2rpx(200);
  48. }
  49. .cwg-submenu-item {
  50. padding: 20px 0px;
  51. cursor: pointer;
  52. color: #0F172B;
  53. font-weight: 600;
  54. transition: background 0.2s;
  55. display: flex;
  56. align-items: center;
  57. gap: 10px;
  58. font-size: 14px;
  59. border-bottom: 1px solid #E2E8F0;
  60. }
  61. .cwg-submenu-item:hover {
  62. // background: #f0f0f0;
  63. }
  64. }
  65. </style>