Ver código fonte

优化细节

icssoa 6 meses atrás
pai
commit
70b71466f7
5 arquivos alterados com 15 adições e 18 exclusões
  1. 3 1
      components/tabbar.uvue
  2. 6 4
      cool/ctx/index.ts
  3. 1 1
      package.json
  4. 5 5
      pnpm-lock.yaml
  5. 0 7
      vite.config.ts

+ 3 - 1
components/tabbar.uvue

@@ -66,7 +66,9 @@ const list = computed<Item[]>(() => {
 
 // 隐藏原生 tabBar
 // #ifndef MP
-uni.hideTabBar();
+if (ctx.tabBar.list != null) {
+	uni.hideTabBar();
+}
 // #endif
 </script>
 

+ 6 - 4
cool/ctx/index.ts

@@ -1,4 +1,4 @@
-import { isArray, isEmpty, isNull } from "../utils";
+import { isArray, parse } from "../utils";
 
 type Page = {
 	path: string;
@@ -49,7 +49,9 @@ export type Ctx = {
 };
 
 // 初始化 ctx 对象,不可修改!!
-export const ctx = {} as Ctx;
+export const ctx = parse<Ctx>({})!;
+
+console.log(ctx);
 
 // PAGES 用于存储所有页面的路径及样式信息
 export let PAGES: Page[] = [...ctx.pages];
@@ -77,8 +79,8 @@ PAGES.forEach((e) => {
 export let TABS: TabBarItem[] = [];
 
 // 如果 tabBar 配置存在且列表不为空,则初始化 TABS
-if (!isNull(ctx.tabBar) && !isEmpty(ctx.tabBar.list!)) {
-	TABS = ctx.tabBar.list!;
+if (ctx.tabBar.list != null) {
+	TABS = ctx.tabBar.list;
 
 	// 确保每个 tabBar 页面的路径都以 "/" 开头
 	TABS.forEach((e) => {

+ 1 - 1
package.json

@@ -15,7 +15,7 @@
 		"@babel/parser": "^7.27.5",
 		"@babel/types": "^7.27.6",
 		"@cool-vue/ai": "^1.1.7",
-		"@cool-vue/vite-plugin": "^8.2.10",
+		"@cool-vue/vite-plugin": "^8.2.11",
 		"@dcloudio/types": "^3.4.16",
 		"@types/node": "^24.0.15",
 		"@vue/compiler-sfc": "^3.5.16",

+ 5 - 5
pnpm-lock.yaml

@@ -28,8 +28,8 @@ importers:
         specifier: ^1.1.7
         version: 1.1.7
       '@cool-vue/vite-plugin':
-        specifier: ^8.2.10
-        version: 8.2.10
+        specifier: ^8.2.11
+        version: 8.2.11
       '@dcloudio/types':
         specifier: ^3.4.16
         version: 3.4.16
@@ -88,8 +88,8 @@ packages:
     resolution: {integrity: sha512-zXjuydK6Rzfywr69bR9qnWueS09rqfuv4bbVKSntnHnApqpb6Dow7yOcR+CwzaCkSYJCnbM2DG2Wc0ZDQQe1oQ==}
     hasBin: true
 
-  '@cool-vue/vite-plugin@8.2.10':
-    resolution: {integrity: sha512-CukFbHN5hc6l8Sv7mZrzsahUdnzc7ONHJGbD5Nv0G10YNFV6JNUpfFNjY5ilLdv8IIaTV3DD0vueqDHrMFHSRg==}
+  '@cool-vue/vite-plugin@8.2.11':
+    resolution: {integrity: sha512-xh0+YQAHi5JiRg7UGv1r3uoKnFmJzfU43+T6tM/74OPkG8CLCENLr0+2H+p/iJWB/sj19gKEknXgLb3WWM4k6Q==}
 
   '@dcloudio/types@3.4.16':
     resolution: {integrity: sha512-gJIr1OWtePTDDdjtp8Kh72S/ZGLunoSfHiUvRtXhBmAFNkDWuAKFO90hv62k3GYN/st04xUBQNtBfvhu/YHjww==}
@@ -1376,7 +1376,7 @@ snapshots:
     transitivePeerDependencies:
       - debug
 
-  '@cool-vue/vite-plugin@8.2.10':
+  '@cool-vue/vite-plugin@8.2.11':
     dependencies:
       '@vue/compiler-sfc': 3.5.17
       axios: 1.10.0

+ 0 - 7
vite.config.ts

@@ -32,12 +32,5 @@ export default defineConfig({
 		postcss: {
 			plugins: [tailwindcss({ config: resolve("./tailwind.config.ts") })]
 		}
-	},
-
-	resolve: {
-		alias: {
-			"@": resolve("./"),
-			$: resolve("./uni_modules/")
-		}
 	}
 });