zhangxiao
2024-08-20 e47b788ff5f5c699c682999c95da17eb284ca21d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<template>
    <div :class="['frame-view', $slots.bottom ? 'frame-view-pdm' : '', props.fixedHeight ? 'frame-fixed-height' : '']">
        <div :class="['frame-view-content', props.contentClass]">
            <a-page-header v-if="pageHeader" v-bind="pageHeader" @back="routerHelper.back()" />
            <slot></slot>
        </div>
        <div v-if="$slots.bottom" class="frame-view-bottom" :style="bottomStyle">
            <slot name="bottom"></slot>
        </div>
    </div>
</template>
 
<script lang="ts" setup name="FrameView">
import global from "@/config/pinia/global";
import routerHelper from "@/utils/helper/router";
import { PageHeader } from "@arco-design/web-vue";
 
const layoutModeHeight = computed(() => {
    const mode = global().app.layout;
    if (mode === "left") {
        return "calc(100vh - 94px)";
    } else {
        return "calc(100vh - 120px)";
    }
});
 
const props = withDefaults(
    defineProps<{
        contentClass?: string;
        fixedHeight?: boolean;
        pageHeader?: InstanceType<typeof PageHeader>["$props"];
    }>(),
    {
        contentClass: "",
        fixedHeight: false,
        pageHeader: undefined
    }
);
 
const bottomStyle = computed(() => {
    return {
        width: global().collapsed ? "calc(100% - 48px)" : "calc(100% - 200px)"
    };
});
</script>
<style lang="scss" scoped>
.frame-view-pdm {
    padding-bottom: 60px;
}
.frame-fixed-height {
    height: v-bind(layoutModeHeight);
    overflow: hidden;
    .frame-view-content {
        height: calc(100% - 40px);
    }
}
.frame-view {
    display: flex;
    flex-direction: column;
    position: relative;
    .frame-view-content {
        background-color: var(--color-bg-2);
        flex: 1;
        padding: 24px;
        margin: 20px;
        overflow-y: auto;
    }
    .frame-view-bottom {
        position: fixed;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 60px;
        background-color: var(--color-bg-2);
        border-top: 1px solid var(--color-border);
        z-index: 100;
    }
}
</style>