feat: 更新依赖版本,添加PWA更新组件,优化Sidebar组件,增加footer支持

This commit is contained in:
xiongxiao
2026-03-22 13:54:30 +08:00
committed by cnb
parent 518a3f2864
commit dd100fd7ef
9 changed files with 175 additions and 37 deletions

View File

@@ -32,6 +32,39 @@ export default defineConfig({
tailwindcss(),
VitePWA({
injectRegister: 'auto',
registerType: 'autoUpdate',
// Workbox 缓存策略配置
workbox: {
// API 请求使用网络优先策略,确保获取最新数据
runtimeCaching: [
{
urlPattern: /^https?.*\/api\/.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24, // 24小时
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
// 静态资源使用缓存优先,但设置较短过期时间
{
urlPattern: /^https?.*\.(js|css|woff2?|png|jpg|jpeg|svg|gif|ico)/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'static-resources',
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7天
},
},
},
],
},
}),
],
resolve: {