diff --git a/index.html b/index.html
index da2b6f6..102a67b 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,9 @@
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
/>
+
+
+
%VITE_APP_TITLE%
diff --git a/package.json b/package.json
index d1dd9f4..4512d2f 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"unplugin-auto-import": "19.1.1",
"unplugin-vue-components": "28.4.1",
"vite": "6.2.0",
+ "vite-plugin-pwa": "0.21.1",
"vite-svg-loader": "5.1.0",
"vitest": "3.0.7",
"vue-tsc": "2.2.6"
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100644
index 0000000..45317fd
Binary files /dev/null and b/public/apple-touch-icon.png differ
diff --git a/public/pwa-192x192.png b/public/pwa-192x192.png
new file mode 100644
index 0000000..c3c78e5
Binary files /dev/null and b/public/pwa-192x192.png differ
diff --git a/public/pwa-512x512.png b/public/pwa-512x512.png
new file mode 100644
index 0000000..f25164f
Binary files /dev/null and b/public/pwa-512x512.png differ
diff --git a/public/robota.txt b/public/robota.txt
new file mode 100644
index 0000000..c2a49f4
--- /dev/null
+++ b/public/robota.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Allow: /
diff --git a/tsconfig.json b/tsconfig.json
index fcd278d..16da7c5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -22,7 +22,7 @@
"@@/*": ["src/common/*"]
},
"resolveJsonModule": true,
- "types": ["vite/client"],
+ "types": ["vite/client", "vite-plugin-pwa/client"],
// 允许导入 .ts .mts .tsx 拓展名的文件
"allowImportingTsExtensions": true,
// 允许 JS
diff --git a/vite.config.ts b/vite.config.ts
index 65c986c..8dbf6cf 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -8,6 +8,7 @@ import UnoCSS from "unocss/vite"
import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import { defineConfig, loadEnv } from "vite"
+import { VitePWA } from "vite-plugin-pwa"
import svgLoader from "vite-svg-loader"
// Configuring Vite: https://cn.vite.dev/config
@@ -121,6 +122,34 @@ export default defineConfig(({ mode }) => {
Components({
dts: "types/auto/components.d.ts",
resolvers: [VantResolver()]
+ }),
+ // PWA
+ VitePWA({
+ includeAssets: ["favicon.png", "apple-touch-icon.png"],
+ manifest: {
+ name: "MobVue",
+ short_name: "MobVue",
+ description: "A crafted mobile template",
+ theme_color: "#ffffff",
+ icons: [
+ {
+ src: "pwa-192x192.png",
+ sizes: "192x192",
+ type: "image/png"
+ },
+ {
+ src: "pwa-512x512.png",
+ sizes: "512x512",
+ type: "image/png"
+ },
+ {
+ src: "pwa-512x512.png",
+ sizes: "512x512",
+ type: "image/png",
+ purpose: ["any", "maskable"]
+ }
+ ]
+ }
})
],
// Configuring Vitest: https://cn.vitest.dev/config
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy