| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <div class="layout">
- <div
- v-if="$slots.title"
- class="layout-title"
- >
- <slot name="title" />
- </div>
- <div
- class="layout-content"
- :style="cssVar"
- >
- <slot name="content" />
- </div>
- <div
- v-if="$slots.bottom"
- class="layout-bottom"
- >
- <slot name="bottom" />
- </div>
- </div>
- </template>
- <script setup lang='ts'>
- import { computed, useSlots } from 'vue'
- const slots = useSlots()
- const cssVar = computed(() => ({
- '--autoHeigh': slots.title && slots.bottom ? 'calc(100% - 95px)' : !slots.title && slots.bottom ? 'calc(100% - 50px)' : slots.title && !slots.bottom ? 'calc(100% - 45px)' : '100%'
- }))
- </script>
- <style lang="scss" scoped>
- .layout {
- height: 100%;
- padding: 40px 4% 0 4%;
- min-width: 327px;
- &-title {
- font-size: 18px;
- height: 25px;
- margin-bottom: 20px;
- }
- &-content {
- text-align: center;
- padding-bottom: 20px;
- display: flex;
- flex-wrap: wrap;
- align-content: flex-start;
- height: var(--autoHeigh);
- overflow-y: auto;
- gap: 15px;
- }
- &-bottom {
- width: 100%;
- height: 50px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- :deep(.n-button) {
- --n-width: 30%;
- max-width: 200px;
- --n-border-radius: 10px;
- }
- }
- }
- </style>
|