瀏覽代碼

fix: 修复无法隐藏原生tabbar

王家程 10 月之前
父節點
當前提交
22c22d904c
共有 7 個文件被更改,包括 22 次插入62 次删除
  1. 1 1
      src/App.vue
  2. 2 2
      src/components/MNavBar/index.vue
  3. 1 7
      src/manifest.json
  4. 10 1
      src/pages/index/index.vue
  5. 6 48
      src/pages/mine/index.vue
  6. 0 1
      types/components.d.ts
  7. 2 2
      vite.config.ts

+ 1 - 1
src/App.vue

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2024-05-27 11:50:13
  * @LastEditors: wjc
- * @LastEditTime: 2024-07-08 18:00:30
+ * @LastEditTime: 2024-07-10 16:55:15
  * @Description: 
 -->
 <script setup lang="ts">

+ 2 - 2
src/components/MNavBar/index.vue

@@ -2,13 +2,13 @@
  * @Author: wjc
  * @Date: 2024-07-03 10:35:44
  * @LastEditors: wjc
- * @LastEditTime: 2024-07-10 16:12:32
+ * @LastEditTime: 2024-07-10 17:20:56
  * @Description: 
 -->
 <template>
   <up-navbar ref="mNavBarRef" v-bind="$attrs" class="m-navbar" placeholder :bg-color="bgColor">
     <template #left>
-      <view v-if="notBack"></view>
+      <view v-if="notBack" class="wh-24px"></view>
       <view v-else class="i-ep-arrow-left wh-24px cursor-pointer" @click="goBack"></view>
     </template>
     <template #center>

+ 1 - 7
src/manifest.json

@@ -6,18 +6,12 @@
     "versionCode" : "100",
     "transformPx" : false,
     "h5" : {
-        "darkmode" : true,
-        "themeLocation" : "theme.json" // 如果 theme.json 在根目录可省略
     },
     /* 5+App特有相关 */
     "app-plus" : {
-        "darkmode": true,
-        "themeLocation": "theme.json",
         "safearea": { //iOS平台的安全区域
-            "background": "#ffffff",
-            "backgroundDark": "#2f0508", // HX 3.1.19+支持
             "bottom": {
-                "offset": "auto"
+                "offset": "none"
             }
         },
         "usingComponents" : true,

+ 10 - 1
src/pages/index/index.vue

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2019-08-22 19:41:20
  * @LastEditors: wjc
- * @LastEditTime: 2024-07-10 16:08:13
+ * @LastEditTime: 2024-07-10 17:10:32
  * @Description: 
 -->
 <template>
@@ -25,6 +25,8 @@
 </template>
 
 <script setup lang="ts">
+  import { onLaunch, onShow } from '@dcloudio/uni-app'
+
   const title = ref('自定义图标')
   const icon = ref('anl')
 
@@ -33,6 +35,13 @@
       url: '/pages/test/index',
     })
   }
+
+  onLaunch(() => {
+    uni.hideTabBar()
+  })
+  onShow(() => {
+    uni.hideTabBar()
+  })
 </script>
 
 <style lang="scss">

+ 6 - 48
src/pages/mine/index.vue

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2024-06-17 16:02:59
  * @LastEditors: wjc
- * @LastEditTime: 2024-07-10 11:40:21
+ * @LastEditTime: 2024-07-10 16:59:31
  * @Description: 
 -->
 <template>
@@ -27,6 +27,7 @@
 </template>
 
 <script setup lang="ts">
+  import { onLaunch } from '@dcloudio/uni-app'
   import { useUserStore } from '@/stores/modules/userStore'
   import { useAppStore } from '@/stores/modules/appStore'
 
@@ -36,53 +37,6 @@
   const appStore = useAppStore()
   const logoutShow = ref(false)
 
-  const originNavBarStyle = computed(() => {
-    if (appStore.isDark) {
-      return {
-        frontColor: '#ffffff',
-        backgroundColor: '#1a1a1a',
-        animation: {
-          duration: 0,
-          timingFunc: 'easeIn',
-        },
-      }
-    } else {
-      return {
-        frontColor: '#000000',
-        backgroundColor: '#f8f8f8',
-        animation: {
-          duration: 0,
-          timingFunc: 'easeIn',
-        },
-      }
-    }
-  })
-
-  // watch(
-  //   () => appStore.isDark,
-  //   (value) => {
-  //     if (value) {
-  //       uni.setNavigationBarColor({
-  //         frontColor: '#ffffff',
-  //         backgroundColor: '#1a1a1a',
-  //         animation: {
-  //           duration: 0,
-  //           timingFunc: 'easeIn',
-  //         },
-  //       })
-  //     } else {
-  //       uni.setNavigationBarColor({
-  //         frontColor: '#000000',
-  //         backgroundColor: '#f8f8f8',
-  //         animation: {
-  //           duration: 0,
-  //           timingFunc: 'easeIn',
-  //         },
-  //       })
-  //     }
-  //   }
-  // )
-
   const handleCancel = () => {
     logoutShow.value = false
   }
@@ -103,4 +57,8 @@
       }
     })
   }
+
+  onLaunch(() => {
+    uni.hideTabBar()
+  })
 </script>

+ 0 - 1
types/components.d.ts

@@ -9,7 +9,6 @@ declare module 'vue' {
   export interface GlobalComponents {
     MButton: typeof import('./../src/components/MButton/index.vue')['default']
     MCard: typeof import('./../src/components/MCard/index.vue')['default']
-    MContainer: typeof import('./../src/components/MContainer/index.vue')['default']
     MFooter: typeof import('./../src/components/MFooter/index.vue')['default']
     MIcon: typeof import('./../src/components/MIcon/index.vue')['default']
     MNavBar: typeof import('./../src/components/MNavBar/index.vue')['default']

+ 2 - 2
vite.config.ts

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2024-05-27 10:17:11
  * @LastEditors: wjc
- * @LastEditTime: 2024-07-10 11:56:30
+ * @LastEditTime: 2024-07-10 16:37:37
  * @Description:
  */
 import path from 'node:path'
@@ -43,8 +43,8 @@ export default defineConfig(({ mode }) => {
       },
     },
     plugins: [
-      uni(),
       UniLayouts(),
+      uni(),
       // UniPages(),
       //自动注册页面全局组件
       UniProvider(),