Topbar.vue
1.14 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
<script setup lang="ts">
import { useRouter } from 'vue-router'
const emit = defineEmits<{ (e: 'toggleSidebar'): void }>()
const router = useRouter()
function logout() {
localStorage.removeItem('token')
router.push('/login')
}
</script>
<template>
<header class="topbar">
<button class="icon-btn" @click="emit('toggleSidebar')">☰</button>
<div class="title">SCRM Base</div>
<div class="spacer" />
<div class="actions">
<button class="text-btn" @click="logout">退出</button>
</div>
</header>
</template>
<style scoped>
.topbar {
height: 56px;
display: flex;
align-items: center;
padding: 0 12px;
background: #ffffff;
border-bottom: 1px solid #e5e7eb;
}
.title {
font-weight: 600;
margin-left: 8px;
}
.spacer {
flex: 1;
}
.actions {
display: flex;
align-items: center;
gap: 8px;
}
.icon-btn {
width: 32px;
height: 32px;
border: 1px solid #e5e7eb;
background: #fff;
border-radius: 6px;
cursor: pointer;
}
.text-btn {
border: 1px solid #e5e7eb;
background: #fff;
border-radius: 6px;
padding: 6px 10px;
cursor: pointer;
}
.icon-btn:hover, .text-btn:hover { background: #f9fafb; }
</style>