lisy преди 6 месеца
родител
ревизия
3cd83532f4
променени са 3 файла, в които са добавени 35 реда и са изтрити 24 реда
  1. 6 0
      src/manifest.json
  2. 5 5
      src/types/auto-imports.d.ts
  3. 24 19
      vite.config.ts

+ 6 - 0
src/manifest.json

@@ -1,4 +1,10 @@
 {
+   "h5": {
+    "router": {
+      "mode": "history",
+      "base": "/"  // 可设置基础路径
+    }
+  },
     "name" : "",
     "appid" : "",
     "description" : "",

+ 5 - 5
src/types/auto-imports.d.ts

@@ -24,8 +24,8 @@ declare global {
   const nextTick: typeof import('vue')['nextTick']
   const onActivated: typeof import('vue')['onActivated']
   const onBeforeMount: typeof import('vue')['onBeforeMount']
-  const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
-  const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
+  // const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
+  // const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
   const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
   const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
   const onDeactivated: typeof import('vue')['onDeactivated']
@@ -56,10 +56,10 @@ declare global {
   const useCssModule: typeof import('vue')['useCssModule']
   const useCssVars: typeof import('vue')['useCssVars']
   const useId: typeof import('vue')['useId']
-  const useLink: typeof import('vue-router')['useLink']
+  // const useLink: typeof import('vue-router')['useLink']
   const useModel: typeof import('vue')['useModel']
-  const useRoute: typeof import('vue-router')['useRoute']
-  const useRouter: typeof import('vue-router')['useRouter']
+  // const useRoute: typeof import('vue-router')['useRoute']
+  // const useRouter: typeof import('vue-router')['useRouter']
   const useSlots: typeof import('vue')['useSlots']
   const useTemplateRef: typeof import('vue')['useTemplateRef']
   const watch: typeof import('vue')['watch']

+ 24 - 19
vite.config.ts

@@ -1,24 +1,24 @@
-import { defineConfig } from 'vite';
-import uni from '@dcloudio/vite-plugin-uni';
-import path from 'path';
-import AutoImport from 'unplugin-auto-import/vite';
-import { visualizer } from 'rollup-plugin-visualizer';
+import { defineConfig } from "vite";
+import uni from "@dcloudio/vite-plugin-uni";
+import path from "path";
+import AutoImport from "unplugin-auto-import/vite";
+import { visualizer } from "rollup-plugin-visualizer";
 export default async () => {
-   const UnoCSS = (await import('unocss/vite')).default;
+    const UnoCSS = (await import("unocss/vite")).default;
     return defineConfig({
         define: {
-            'process.env': process.env, // 配置变量在业务代码内生效
+            "process.env": process.env, // 配置变量在业务代码内生效
         },
         plugins: [
             uni(),
             AutoImport({
                 imports: [
                     // 预设
-                    'vue',
-                    'uni-app',
-                    'pinia',
+                    "vue",
+                    "uni-app",
+                    "pinia",
                 ],
-                dts: true
+                dts: true,
             }),
             UnoCSS(),
             visualizer(),
@@ -27,26 +27,31 @@ export default async () => {
             preprocessorOptions: {
                 scss: {
                     // 取消sass废弃API的报警
-                    silenceDeprecations: ['legacy-js-api', 'color-functions', 'import'],
+                    silenceDeprecations: [
+                        "legacy-js-api",
+                        "color-functions",
+                        "import",
+                    ],
                 },
             },
         },
         resolve: {
             alias: {
-                '@': path.resolve(__dirname, 'src'),
+                "@": path.resolve(__dirname, "src"),
             },
         },
         server: {
             proxy: {
-                '/subpackage': {
-                    target: 'https://yunnan.yujin.yunyaozhuisu.com',
+                "/subpackage": {
+                    target: "https://yunnan.yujin.yunyaozhuisu.com",
                     changeOrigin: true,
-                    rewrite: (path) => path.replace(/^\/subpackage/, '/subpackage'),
+                    rewrite: (path) =>
+                        path.replace(/^\/subpackage/, "/subpackage"),
                 },
-                '/pyapi': {
-                    target: 'https://yunnan.yujin.yunyaozhuisu.com',
+                "/pyapi": {
+                    target: "https://yunnan.yujin.yunyaozhuisu.com",
                     changeOrigin: true,
-                    rewrite: (path) => path.replace(/^\/pyapi/, '/pyapi'),
+                    rewrite: (path) => path.replace(/^\/pyapi/, "/pyapi"),
                 },
             },
             // 启动端口