Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-01-11 15:51:22 +07:00
parent 6f8a8de9be
commit 309606565b
46 changed files with 28649 additions and 28522 deletions

View File

@@ -1,49 +1,49 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
'@nuxt/ui',
'@nuxtjs/i18n',
'@nuxt/eslint',
'@vite-pwa/nuxt',
"@nuxt/ui",
"@nuxtjs/i18n",
"@nuxt/eslint",
"@vite-pwa/nuxt",
],
devtools: { enabled: true },
pwa: {
registerType: 'autoUpdate',
registerType: "autoUpdate",
manifest: {
name: 'Riwa应用商店',
short_name: 'Riwa应用商店',
description: 'Riwa App 下载 - iOS, Android, H5',
theme_color: '#3b82f6',
background_color: '#ffffff',
display: 'standalone',
scope: '/',
start_url: '/',
name: "Riwa应用商店",
short_name: "Riwa应用商店",
description: "Riwa App 下载 - iOS, Android, H5",
theme_color: "#3b82f6",
background_color: "#ffffff",
display: "standalone",
scope: "/",
start_url: "/",
icons: [
{
src: '/favicon.svg',
sizes: '512x512',
type: 'image/svg+xml',
purpose: 'any',
src: "/favicon.svg",
sizes: "512x512",
type: "image/svg+xml",
purpose: "any",
},
{
src: '/favicon.svg',
sizes: '192x192',
type: 'image/svg+xml',
src: "/favicon.svg",
sizes: "192x192",
type: "image/svg+xml",
},
],
},
workbox: {
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
navigateFallback: "/",
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'CacheFirst',
handler: "CacheFirst",
options: {
cacheName: 'google-fonts-cache',
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
@@ -55,9 +55,9 @@ export default defineNuxtConfig({
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: 'CacheFirst',
handler: "CacheFirst",
options: {
cacheName: 'gstatic-fonts-cache',
cacheName: "gstatic-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
@@ -75,81 +75,81 @@ export default defineNuxtConfig({
},
devOptions: {
enabled: true,
type: 'module',
type: "module",
},
injectManifest: {
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
},
},
css: [
'~/assets/css/main.css',
'~/assets/css/animations.css',
"~/assets/css/main.css",
"~/assets/css/animations.css",
],
colorMode: {
preference: 'light',
preference: "light",
},
i18n: {
defaultLocale: 'zh-CN',
defaultLocale: "zh-CN",
locales: [
{
code: 'zh-CN',
name: '简体中文',
file: 'zh-CN.json',
code: "zh-CN",
name: "简体中文",
file: "zh-CN.json",
},
{
code: 'en-US',
name: 'English',
file: 'en-US.json',
code: "en-US",
name: "English",
file: "en-US.json",
},
],
strategy: 'no_prefix',
strategy: "no_prefix",
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_locale',
redirectOn: 'root',
cookieKey: "i18n_locale",
redirectOn: "root",
},
},
app: {
head: {
charset: 'utf-8',
viewport: 'width=device-width, initial-scale=1',
title: 'Riwa App 下载',
charset: "utf-8",
viewport: "width=device-width, initial-scale=1",
title: "Riwa App 下载",
meta: [
{ name: 'description', content: 'Riwa App 下载 - iOS, Android, H5' },
{ name: "description", content: "Riwa App 下载 - iOS, Android, H5" },
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
],
},
},
devServer:{
host: '0.0.0.0'
devServer: {
host: "0.0.0.0",
},
nitro: {
prerender: {
routes: ['/'],
routes: ["/"],
crawlLinks: true,
},
},
hooks: {
async 'nitro:config'(nitroConfig) {
"nitro:config": async function (nitroConfig) {
// 预渲染所有应用详情页
const { apps } = await import('./data/apps')
const routes = apps.map(app => `/apps/${app.id}`)
nitroConfig.prerender = nitroConfig.prerender || {}
const { apps } = await import("./data/apps");
const routes = apps.map(app => `/apps/${app.id}`);
nitroConfig.prerender = nitroConfig.prerender || {};
nitroConfig.prerender.routes = [
...(nitroConfig.prerender.routes || []),
...routes,
]
];
},
},
compatibilityDate: '2025-12-30',
})
compatibilityDate: "2025-12-30",
});