AppLayout.vue
1.16 KB
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
<!--
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 14:05:01
* @FilePath: /mlaj/src/components/layout/AppLayout.vue
* @Description: 文件描述
-->
<template>
<div class="bg-gradient-to-br from-green-50 via-teal-50 to-blue-50 min-h-screen pb-16">
<GradientHeader
v-if="title"
:title="title"
:showBackButton="showBackButton"
:onBack="handleBack"
:rightContent="rightContent"
/>
<main :class="{ 'pb-16': title, 'py-4': !title }">
<slot></slot>
</main>
<BottomNav v-if="!hideBottomNav" />
</div>
</template>
<script setup>
import BottomNav from './BottomNav.vue'
import GradientHeader from '../ui/GradientHeader.vue'
const props = defineProps({
title: {
type: String,
required: false
},
showBackButton: {
type: Boolean,
default: false
},
onBack: {
type: Function,
default: null
},
rightContent: {
type: Object,
default: null
},
hideBottomNav: {
type: Boolean,
default: false
}
})
const handleBack = () => {
if (props.onBack) {
props.onBack()
} else {
window.history.back()
}
}
</script>