lex-xin 3 年之前
父節點
當前提交
99acd51f4f
共有 17 個文件被更改,包括 1189 次插入10 次删除
  1. 1 1
      index.html
  2. 10 0
      package-lock.json
  3. 6 1
      package.json
  4. 二進制
      public/favicon.ico
  5. 二進制
      public/pwa-192x192.png
  6. 二進制
      public/pwa-512x512.png
  7. 6 3
      src/App.vue
  8. 4 1
      src/main.ts
  9. 12 0
      src/pages/404/index.tsx
  10. 12 0
      src/pages/500/index.tsx
  11. 12 0
      src/pages/home/index.tsx
  12. 0 0
      src/pages/login/index.module.less
  13. 25 0
      src/pages/login/index.tsx
  14. 8 0
      src/router.ts
  15. 21 0
      src/routes.tsx
  16. 12 2
      vite.config.ts
  17. 1060 2
      yarn.lock

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8" />
     <link rel="icon" href="/favicon.ico" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>Vite App</title>
+    <title>管乐迷</title>
   </head>
   <body>
     <div id="app"></div>

+ 10 - 0
package-lock.json

@@ -57,6 +57,8 @@
     },
     "@vitejs/plugin-vue": {
       "version": "2.2.0",
+      "resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-2.2.0.tgz",
+      "integrity": "sha512-wXigM1EwN2G7rZcwG6kLk9ivvIMhx2363tCEvMBiXcTu5nePM/12hUPVzPb83Uugt6U+zom1gTpJopi/Ow/jwg==",
       "dev": true
     },
     "@volar/code-gen": {
@@ -915,6 +917,8 @@
     },
     "typescript": {
       "version": "4.5.5",
+      "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.5.5.tgz",
+      "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
       "dev": true
     },
     "upath": {
@@ -925,6 +929,8 @@
     },
     "vite": {
       "version": "2.8.1",
+      "resolved": "https://registry.npmmirror.com/vite/-/vite-2.8.1.tgz",
+      "integrity": "sha512-Typ8qjUnW0p53gBsJpisrKcZlEbUPZATja9BG6Z09QZjg9YrnEn/htkr/VH4WhnH7eNUQeSD+wKI1lHzQRWskw==",
       "dev": true,
       "requires": {
         "esbuild": "^0.14.14",
@@ -1112,6 +1118,8 @@
     },
     "vue": {
       "version": "3.2.31",
+      "resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.31.tgz",
+      "integrity": "sha512-odT3W2tcffTiQCy57nOT93INw1auq5lYLLYtWpPYQQYQOOdHiqFct9Xhna6GJ+pJQaF67yZABraH47oywkJgFw==",
       "requires": {
         "@vue/compiler-dom": "3.2.31",
         "@vue/compiler-sfc": "3.2.31",
@@ -1122,6 +1130,8 @@
     },
     "vue-tsc": {
       "version": "0.29.8",
+      "resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-0.29.8.tgz",
+      "integrity": "sha512-pT0wLRjvRuSmB+J4WJT6uuV9mO0KtSSXEAtaVXZQzyk5+DJdbLIQTbRce/TXSkfqt1l1WogO78RjtOJFiMCgfQ==",
       "dev": true,
       "requires": {
         "@volar/shared": "0.29.8",

+ 6 - 1
package.json

@@ -8,13 +8,18 @@
     "preview": "vite preview"
   },
   "dependencies": {
-    "vue": "^3.2.25"
+    "@vitejs/plugin-legacy": "^1.7.1",
+    "@vitejs/plugin-vue-jsx": "^1.3.7",
+    "dayjs": "^1.10.7",
+    "vue": "^3.2.25",
+    "vue-router": "^4.0.12"
   },
   "devDependencies": {
     "@types/node": "^17.0.17",
     "@vitejs/plugin-vue": "^2.2.0",
     "typescript": "^4.5.4",
     "vite": "^2.8.0",
+    "vite-plugin-pwa": "^0.11.13",
     "vue-tsc": "^0.29.8"
   }
 }

二進制
public/favicon.ico


二進制
public/pwa-192x192.png


二進制
public/pwa-512x512.png


+ 6 - 3
src/App.vue

@@ -1,12 +1,15 @@
 <script setup lang="ts">
 // This starter template is using Vue 3 <script setup> SFCs
 // Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
-import HelloWorld from './components/HelloWorld.vue'
+// import HelloWorld from './components/HelloWorld.vue'
 </script>
 
 <template>
-  <img alt="Vue logo" src="./assets/logo.png" />
-  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
+  <!-- <img alt="Vue logo" src="./assets/logo.png" /> -->
+  <!-- <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" /> -->
+  <router-view v-slot="{ Component }">
+    <component :is="Component" />
+  </router-view>
 </template>
 
 <style>

+ 4 - 1
src/main.ts

@@ -1,4 +1,7 @@
 import { createApp } from 'vue'
 import App from './App.vue'
+import { router } from './router'
 
-createApp(App).mount('#app')
+
+createApp(App)
+  .use(router).mount('#app')

+ 12 - 0
src/pages/404/index.tsx

@@ -0,0 +1,12 @@
+import { defineComponent } from "vue";
+
+export default defineComponent({
+  render() {
+    return (
+      <div>
+        <h1>404</h1>
+        <p>Page not found.</p>
+      </div>
+    );
+  }
+})

+ 12 - 0
src/pages/500/index.tsx

@@ -0,0 +1,12 @@
+import { defineComponent } from "vue";
+
+export default defineComponent({
+  render() {
+    return (
+      <div>
+        <h1>500</h1>
+        <p>Internal server error.</p>
+      </div>
+    );
+  }
+})

+ 12 - 0
src/pages/home/index.tsx

@@ -0,0 +1,12 @@
+import { defineComponent } from "vue";
+
+export default defineComponent({
+  render() {
+    return (
+      <div>
+        <h1>Home</h1>
+        <p>This is the home page.</p>
+      </div>
+    )
+  }
+});

+ 0 - 0
src/pages/login/index.module.less


+ 25 - 0
src/pages/login/index.tsx

@@ -0,0 +1,25 @@
+import { defineComponent } from "vue"
+
+export default defineComponent({
+  render() {
+    return (
+      <div>
+        <div class="login-container">
+          <div class="login-title">
+          </div>
+          <div class="login-form">
+            <div class="login-input">
+              <input type="text" placeholder="用户名" />
+            </div>
+            <div class="login-input">
+              <input type="password" placeholder="密码" />
+            </div>
+            <div class="login-button">
+              <button>登录</button>
+            </div>
+          </div>
+        </div>
+      </div>
+    )
+  }
+})

+ 8 - 0
src/router.ts

@@ -0,0 +1,8 @@
+import { createRouter, createWebHashHistory } from 'vue-router'
+// import VueRouter from 'vue-router'
+import routes from './routes'
+
+export const router = createRouter({
+  history: createWebHashHistory(),
+  routes
+})

+ 21 - 0
src/routes.tsx

@@ -0,0 +1,21 @@
+export default [
+  {
+    path: '/',
+    component: import(/* @vite-ignore */ `../src/pages/home/index`),
+  },
+  {
+    path: '/home',
+    component: import(/* @vite-ignore */ `../src/pages/home/index`),
+  },
+  {
+    path: '/login',
+    component: import(/* @vite-ignore */ `../src/pages/login/index`),
+  },
+  {
+    path: '/:pathMatch(.*)*',
+    component: import(/* @vite-ignore */ `../src/pages/404/index`),
+    meta: {
+      title: '404 Not Fund'
+    }
+  }
+]

+ 12 - 2
vite.config.ts

@@ -1,6 +1,7 @@
 import { defineConfig } from "vite";
 import vue from "@vitejs/plugin-vue";
 import { VitePWA } from 'vite-plugin-pwa'
+import { hostname } from "os";
 const vueJsx = require('@vitejs/plugin-vue-jsx')
 const legacy = require('@vitejs/plugin-legacy')
 
@@ -16,7 +17,7 @@ export default defineConfig({
       ignoreBrowserslistConfig: true,
     }),
     VitePWA({
-      injectRegister: 'networkfirst',
+      injectRegister: "auto",
       workbox: {
         cleanupOutdatedCaches: true
       },
@@ -38,6 +39,15 @@ export default defineConfig({
           },
         ],
       },
-    }),
+    })
   ],
+  server: {
+    cors: true,
+    proxy: {
+      '/api-web': {
+        target: proxyUrl,
+        changeOrigin: true
+      }
+    }
+  }
 });

File diff suppressed because it is too large
+ 1060 - 2
yarn.lock


Some files were not shown because too many files changed in this diff