123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <div class="w-full fold">
- <div class="foldingTheHead" @click="handleBox" :style="`background-color: ${bgColor}`">
- <div class="flex items-center">
- <van-icon name="play" class="text-size-in" color="#FF8B32" />
- <div class="text-[#FF8B32] pl-1">{{ title }}</div>
- </div>
- <slot name="foldingRight"></slot>
- </div>
- <div class="container">
- <div :class="selClassName">
- <slot name="primaryCoverage"></slot>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref } from 'vue';
- import { useLifecycle } from "@hooks/useCommon.js";
- const props = defineProps({
- bgColor: {
- type: String,
- default: '#FFEFE2'
- },
- title: {
- type: String,
- default: '标题'
- }
- })
- useLifecycle({
- load: () => {
- // 添加加载逻辑
- }
- });
- const selClassName = ref(['sel-menu'])
- const selStatus = ref(false)
- const handleBox = () => {
- if (selStatus.value) {
- selClassName.value.pop()
- selStatus.value = false
- } else {
- selClassName.value.push('expand')
- selStatus.value = true
- }
- }
- </script>
- <style scoped lang="scss">
- .fold {
- margin-bottom: 10px;
- .foldingTheHead {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 8px 16px;
- }
- .container {
- height: calc(100% - 50px);
- background-color: antiquewhite;
- display: flex;
- justify-content: center;
- // 折叠样式
- .sel-menu {
- width: 100%;
- overflow: hidden;
- cursor: pointer;
- transition: max-height 0.5s linear;
- position: relative;
- }
- .sel-menu {
- max-height: 0;
- }
- .expand {
- max-height: 1000px;
- }
- }
- }
- </style>
|