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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
| <template>
| <div class="bottom-nav">
| <div
| v-for="item in navItems"
| :key="item.path"
| class="nav-item"
| :class="{ active: $route.path === item.path }"
| @click="$router.push(item.path)"
| >
| <div class="nav-icon" v-html="item.icon"></div>
| <span class="nav-label">{{ item.label }}</span>
| </div>
| </div>
| </template>
|
| <script setup lang="ts">
| import { useRoute } from 'vue-router'
|
| const route = useRoute()
|
| const navItems = [
| {
| path: '/',
| label: '首页',
| icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" fill="currentColor"/></svg>'
| },
| {
| path: '/market',
| label: '行情',
| icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z" fill="currentColor"/></svg>'
| },
| {
| path: '/trade',
| label: '交易',
| icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z" fill="currentColor"/></svg>'
| },
| {
| path: '/discover',
| label: '发现',
| icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" fill="currentColor"/></svg>'
| },
| {
| path: '/wallet',
| label: '钱包',
| icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z" fill="currentColor"/></svg>'
| }
| ]
| </script>
|
| <style lang="scss" scoped>
| @import '@/styles/variables.scss';
|
| .bottom-nav {
| position: fixed;
| bottom: 0;
| left: 0;
| right: 0;
| height: 60px;
| background: #ffffff;
| border-top: 1px solid $border-light;
| display: flex;
| justify-content: space-around;
| align-items: center;
| z-index: 1000;
| padding-bottom: env(safe-area-inset-bottom);
| }
|
| .nav-item {
| display: flex;
| flex-direction: column;
| align-items: center;
| justify-content: center;
| flex: 1;
| cursor: pointer;
|
| &.active {
| .nav-icon {
| color: $primary-blue;
| }
| .nav-label {
| color: $primary-blue;
| }
| }
| }
|
| .nav-icon {
| width: 24px;
| height: 24px;
| color: $text-tertiary;
| margin-bottom: 2px;
|
| svg {
| width: 100%;
| height: 100%;
| }
| }
|
| .nav-label {
| font-size: $font-xs;
| color: $text-tertiary;
| }
| </style>
|
|