Sfoglia il codice sorgente

fix(h5): 设置路由基础路径为根目录

将h5路由的基础路径配置为根目录,确保部署时路径正确。同时在manifest.json和manifest.config.ts中同步此配置,并更新相关文档链接。
feige996 8 mesi fa
parent
commit
5f442e0ed9
3 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 1 0
      env/.env
  2. 1 1
      manifest.config.ts
  3. 3 1
      src/manifest.json

+ 1 - 0
env/.env

@@ -5,6 +5,7 @@ VITE_UNI_APPID = '__UNI__D1E5001'
 VITE_WX_APPID = 'wxa2abb91f64032a2b'
 
 # h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
+# https://uniapp.dcloud.net.cn/collocation/manifest.html#h5-router
 VITE_APP_PUBLIC_BASE=/
 
 # 登录页面

+ 1 - 1
manifest.config.ts

@@ -30,7 +30,7 @@ export default defineManifestConfig({
   'locale': VITE_FALLBACK_LOCALE, // 'zh-Hans'
   'h5': {
     router: {
-      // base: VITE_APP_PUBLIC_BASE,
+      base: VITE_APP_PUBLIC_BASE,
     },
   },
   /* 5+App特有相关 */

+ 3 - 1
src/manifest.json

@@ -109,6 +109,8 @@
   },
   "vueVersion": "3",
   "h5": {
-    "router": {}
+    "router": {
+      "base": "/"
+    }
   }
 }