You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB

  1. <script setup lang="ts">
  2. export interface Props {
  3. isActive: boolean;
  4. }
  5. const props = withDefaults(defineProps<Props>(), {
  6. isActive: false
  7. });
  8. const emit = defineEmits<{
  9. (e: "toggleClick"): void;
  10. }>();
  11. const toggleClick = () => {
  12. emit("toggleClick");
  13. };
  14. </script>
  15. <template>
  16. <div
  17. :class="classes.container"
  18. :title="props.isActive ? '点击折叠' : '点击展开'"
  19. @click="toggleClick"
  20. >
  21. <svg
  22. :class="['hamburger', props.isActive ? 'is-active' : '']"
  23. viewBox="0 0 1024 1024"
  24. xmlns="http://www.w3.org/2000/svg"
  25. width="64"
  26. height="64"
  27. >
  28. <path
  29. d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"
  30. />
  31. </svg>
  32. </div>
  33. </template>
  34. <style module="classes" scoped>
  35. .container {
  36. padding: 0 15px;
  37. }
  38. </style>
  39. <style scoped>
  40. .hamburger {
  41. display: inline-block;
  42. vertical-align: middle;
  43. width: 20px;
  44. height: 20px;
  45. }
  46. .is-active {
  47. transform: rotate(180deg);
  48. }
  49. </style>