From 4ad5489b83b809a681afe157dca97ecc792b6f67 Mon Sep 17 00:00:00 2001 From: tangxinyue <524779910@qq.com> Date: Fri, 24 Jul 2026 15:54:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86=E8=B7=AF=E7=94=B1=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E6=95=B4=E4=B8=BA=E5=90=8C=E6=AD=A5=E5=BC=95?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E6=A0=B9=E9=99=A4=E7=BA=BF=E4=B8=8A=20SW/Dat?= =?UTF-8?q?=20=E7=BC=93=E5=AD=98=E5=BC=95=E5=8F=91=E7=9A=84=20Chunk=20fetc?= =?UTF-8?q?h=20=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98=20(Profile-xxx.js=20?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/core/router/index.cjs | 5 ++++- src/router/index.js | 28 +++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/service/core/router/index.cjs b/service/core/router/index.cjs index df2197d..b59ac01 100644 --- a/service/core/router/index.cjs +++ b/service/core/router/index.cjs @@ -100,8 +100,11 @@ const matchFile = async (request, response) => { 'Content-Type': mimetype, 'Access-Control-Allow-Origin': '*' } - if (cleanPath.endsWith("-sw.js")) { + if (cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) { responseHeaders["Service-Worker-Allowed"] = '/' + responseHeaders["Cache-Control"] = 'no-cache, no-store, must-revalidate' + responseHeaders["Pragma"] = 'no-cache' + responseHeaders["Expires"] = '0' } response.writeHead(httpOk, responseHeaders) response.end(file) diff --git a/src/router/index.js b/src/router/index.js index 9a5a03d..153aafb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,16 +1,26 @@ import { createRouter, createWebHistory } from 'vue-router' import { useUserStore } from '@/stores/user' +import IndexView from '@/views/index/index.vue' +import ChatEdit from '@/views/wxPage/ChatEdit.vue' +import BalanceEdit from '@/views/wxPage/BalanceEdit.vue' +import WorksView from '@/views/work/works.vue' +import AboutView from '@/views/About.vue' +import ProfileView from '@/views/Profile.vue' +import ArticleList from '@/views/article/list.vue' +import ArticleDetail from '@/views/article/detail.vue' +import GongZiDan from '@/views/other/gongzidan.vue' + const routes = [ - { path: '/', name: 'index', component: () => import('@/views/index/index.vue') }, - { path: '/chat', name: 'Chat', component: () => import('@/views/wxPage/ChatEdit.vue'), meta: { requiresAuth: false } }, - { path: '/balance', name: 'Balance', component: () => import('@/views/wxPage/BalanceEdit.vue'), meta: { requiresAuth: false } }, - { path: '/works', name: 'Works', component: () => import('@/views/work/works.vue'), meta: { requiresAuth: true } }, - { path: '/about', name: 'About', component: () => import('@/views/About.vue') }, - { path: '/profile', name: 'Profile', component: () => import('@/views/Profile.vue'), meta: { requiresAuth: true } }, - { path: '/article', name: 'Article', component: () => import('@/views/article/list.vue') }, - { path: '/article-detail', name: 'ArticleDetail', component: () => import('@/views/article/detail.vue') }, - { path: '/gongzidan', name: 'GongZiDan', component: () => import('@/views/other/gongzidan.vue') }, + { path: '/', name: 'index', component: IndexView }, + { path: '/chat', name: 'Chat', component: ChatEdit, meta: { requiresAuth: false } }, + { path: '/balance', name: 'Balance', component: BalanceEdit, meta: { requiresAuth: false } }, + { path: '/works', name: 'Works', component: WorksView, meta: { requiresAuth: true } }, + { path: '/about', name: 'About', component: AboutView }, + { path: '/profile', name: 'Profile', component: ProfileView, meta: { requiresAuth: true } }, + { path: '/article', name: 'Article', component: ArticleList }, + { path: '/article-detail', name: 'ArticleDetail', component: ArticleDetail }, + { path: '/gongzidan', name: 'GongZiDan', component: GongZiDan }, ] const router = createRouter({