404.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="w-full fold">
  3. <div class="foldingTheHead" @click="handleBox" :style="`background-color: ${bgColor}`">
  4. <div class="flex items-center">
  5. <van-icon name="play" class="text-size-in" color="#FF8B32" />
  6. <div class="text-[#FF8B32] pl-1">{{ title }}</div>
  7. </div>
  8. <slot name="foldingRight"></slot>
  9. </div>
  10. <div class="container">
  11. <div :class="selClassName">
  12. <slot name="primaryCoverage"></slot>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup>
  18. import { ref } from 'vue';
  19. import { useLifecycle } from "@hooks/useCommon.js";
  20. const props = defineProps({
  21. bgColor: {
  22. type: String,
  23. default: '#FFEFE2'
  24. },
  25. title: {
  26. type: String,
  27. default: '标题'
  28. }
  29. })
  30. useLifecycle({
  31. load: () => {
  32. // 添加加载逻辑
  33. }
  34. });
  35. const selClassName = ref(['sel-menu'])
  36. const selStatus = ref(false)
  37. const handleBox = () => {
  38. if (selStatus.value) {
  39. selClassName.value.pop()
  40. selStatus.value = false
  41. } else {
  42. selClassName.value.push('expand')
  43. selStatus.value = true
  44. }
  45. }
  46. </script>
  47. <style scoped lang="scss">
  48. .fold {
  49. margin-bottom: 10px;
  50. .foldingTheHead {
  51. display: flex;
  52. justify-content: space-between;
  53. align-items: center;
  54. padding: 8px 16px;
  55. }
  56. .container {
  57. height: calc(100% - 50px);
  58. background-color: antiquewhite;
  59. display: flex;
  60. justify-content: center;
  61. // 折叠样式
  62. .sel-menu {
  63. width: 100%;
  64. overflow: hidden;
  65. cursor: pointer;
  66. transition: max-height 0.5s linear;
  67. position: relative;
  68. }
  69. .sel-menu {
  70. max-height: 0;
  71. }
  72. .expand {
  73. max-height: 1000px;
  74. }
  75. }
  76. }
  77. </style>