Browse Source

feat: 创建

liming 12 hours ago
parent
commit
7e24ac2215
3 changed files with 20 additions and 11 deletions
  1. 17 10
      src/App.vue
  2. 1 0
      src/assets/css/theme.less
  3. 2 1
      src/router/whitelist.js

+ 17 - 10
src/App.vue

@@ -1,7 +1,9 @@
 <template>
   <van-nav-bar
-    :title="$t(route.meta.title)"
     v-if="route.meta.navbar"
+    :left-arrow="route.meta.leftArrow"
+    @click-left="goBack()"
+    :title="$t(route.meta.title)"
     class="app-bar-header"
     :style="notchStyle"
   />
@@ -11,15 +13,21 @@
 <script setup>
 import { getNotchHeight } from "@/utils/statusBar";
 const route = useRoute();
+const router = useRouter();
 
 const notchStyle = ref({});
 const mainStyle = ref({});
- 
+
+const goBack = () => {
+  if (route.meta.navbar) {
+    router.back();
+  }
+};
 
 onBeforeMount(async () => {
   const height = await getNotchHeight();
-  notchStyle.value = {
-    height: `calc(46px + ${height}px)`,
+  notchStyle.value = { 
+    paddingTop: `${height}px`,
   };
 
   if (route.meta.navbar) {
@@ -39,17 +47,16 @@ body {
   height: 100%;
   background-color: @bg-color2;
 }
+ 
 </style>
 
 <style scoped lang="less">
 .app-bar-header {
-  :deep(.van-nav-bar__content) {
-    height: 100%;
+  :deep(.van-nav-bar__title){
+    font-weight: 500;
   }
-  :deep(.van-nav-bar__title) {
-    height: 72%;
-    display: flex;
-    align-items: flex-end;
+  :deep(.van-icon){
+    color: @font-color3;
   }
 }
 </style>

+ 1 - 0
src/assets/css/theme.less

@@ -11,6 +11,7 @@
 // 字体次要颜色
 @font-color1: #ffffff;
 @font-color2: #4F4F4F;
+@font-color3: #000;
 
 
 // 点击颜色

+ 2 - 1
src/router/whitelist.js

@@ -16,7 +16,8 @@ export const whitelistRoutes = [
     meta: {
       title:  "router.SelectMainnet",   // 选择主网
       keepAlive: false,
-      navbar: true
+      navbar: true,
+      leftArrow: true
     }
   }
 ]