cwg-sidebar.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="cwg-sidebar">
  3. <image class="logo" src="/static/images/logo3.png" mode="widthFix" />
  4. <view class="menu">
  5. <view class="menu-item" v-for="item in menu" :key="item.key" @click="handleClick(item)">
  6. <cwg-icon color="#fff" icon="chevron-right" class="arrow" />
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script lang="ts" setup>
  12. import { ref } from 'vue';
  13. import useRouter from "@/hooks/useRouter";
  14. const router = useRouter();
  15. interface MenuItem {
  16. key: string;
  17. label: string;
  18. icon?: string;
  19. children?: MenuItem[];
  20. }
  21. const emit = defineEmits(['menu-click']);
  22. const menu = ref<MenuItem[]>([
  23. { key: 'client', label: 'Client Zone', icon: 'icon-client' },
  24. { key: 'promotion', label: 'Promotion Center', icon: 'icon-promotion' },
  25. { key: 'deposit', label: 'Deposit', icon: 'icon-deposit' },
  26. { key: 'withdrawal', label: 'Withdrawal', icon: 'icon-withdrawal' },
  27. ]);
  28. function handleClick(item: MenuItem) {
  29. router.push(item.key);
  30. }
  31. </script>
  32. <style scoped lang="scss">
  33. @import "@/uni.scss";
  34. .cwg-sidebar {
  35. width: px2rpx(100);
  36. background: #11224d;
  37. color: #fff;
  38. height: 100vh;
  39. display: flex;
  40. flex-direction: column;
  41. align-items: center;
  42. padding-top: px2rpx(20);
  43. box-sizing: border-box;
  44. .logo {
  45. width: px2rpx(54);
  46. }
  47. .menu {
  48. display: flex;
  49. flex-direction: column;
  50. gap: px2rpx(20);
  51. align-items: center;
  52. padding-top: px2rpx(30);
  53. }
  54. .menu-item {
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. width: px2rpx(54);
  59. height: px2rpx(54);
  60. border-radius: px2rpx(12);
  61. cursor: pointer;
  62. background: #122D6B;
  63. transition: background 0.2s;
  64. &:hover {
  65. background: #24325e;
  66. }
  67. }
  68. }
  69. </style>