index.vue
1.31 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<script lang="ts" setup name="PageHeader">
defineProps({
title: {
type: String,
required: true,
},
content: {
type: String,
default: '',
},
})
const slots = useSlots()
</script>
<template>
<div class="header">
<div class="main">
<div class="title">
{{ title }}
</div>
<div class="content">
<slot name="content">
{{ content }}
</slot>
</div>
</div>
<div v-if="slots.default" class="sub">
<slot />
</div>
</div>
</template>
<style lang="scss" scoped>
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
padding: 16px 20px;
background-color: var(--g-app-bg);
transition: background-color 0.3s;
.main {
flex: 1;
margin-right: 20px;
.title {
font-size: 22px;
color: var(--el-text-color-primary);
transition: var(--el-transition-color);
}
.content {
margin-top: 10px;
font-size: 14px;
color: var(--el-text-color-secondary);
transition: var(--el-transition-color);
&:empty {
display: none;
}
}
}
.sub {
flex: none;
}
}
[data-mode="mobile"] {
.header {
flex-direction: column;
.main {
margin-right: auto;
margin-bottom: 20px;
}
}
}
</style>