fix: remove pwa to fix cdn conflict

This commit is contained in:
YunYouJun
2022-06-27 08:49:55 +08:00
parent 7b94e19b20
commit fe47e4d2e7
8 changed files with 50 additions and 1866 deletions

View File

@@ -24,9 +24,9 @@
- [晒晒你的菜](https://docs.qq.com/sheet/DQk1vdkhFV0twQVNS?tab=dmeahc)
- [反馈建议](https://docs.qq.com/sheet/DQk1vdkhFV0twQVNS?tab=snaau2)
### Features
<!-- ### Features -->
本项目支持 PWA使用浏览器打开时可将其添加到主屏幕以获得近原生 APP 的体验。
<!-- 本项目支持 PWA使用浏览器打开时可将其添加到主屏幕以获得近原生 APP 的体验。 -->
## 开发

View File

@@ -9,6 +9,12 @@
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="description" content="好的,今天我们来做菜!">
<title>隔离食用手册</title>
<script>
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations)
registration.unregister()
})
</script>
<script>
(function () {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches

View File

@@ -58,7 +58,6 @@
"vite-plugin-inspect": "^0.5.0",
"vite-plugin-md": "^0.13.1",
"vite-plugin-pages": "^0.24.2",
"vite-plugin-pwa": "^0.12.0",
"vite-plugin-vue-layouts": "^0.6.0",
"vite-ssg": "0.20.1",
"vite-ssg-sitemap": "^0.2.7",

1822
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { installPrompt } from './utils/pwa'
// import { installPrompt } from './utils/pwa'
import { isDark } from '~/composables'
// https://github.com/vueuse/head
// you can use this to manipulate the document head in any components,
@@ -18,7 +18,7 @@ useHead({
],
})
installPrompt()
// installPrompt()
</script>
<template>

View File

@@ -1,12 +1,13 @@
import { type UserModule } from '~/types'
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const install: UserModule = ({ isClient, router }) => {
if (!isClient)
return
// if (!isClient)
// return
router.isReady().then(async () => {
const { registerSW } = await import('virtual:pwa-register')
registerSW({ immediate: true })
})
// router.isReady().then(async () => {
// const { registerSW } = await import('virtual:pwa-register')
// registerSW({ immediate: true })
// })
}

View File

@@ -19,9 +19,9 @@ title: 帮助
## **友情提示**
- 点击首页最上方的大锅图标,可清空所选食材和工具。
- 本项目支持 PWA使用浏览器打开时可将其添加到主屏幕以获得近原生 APP 的体验。
<!-- - 本项目支持 PWA使用浏览器打开时可将其添加到主屏幕以获得近原生 APP 的体验。 -->
<InstallPwa />
<!-- <InstallPwa /> -->
## FAQ

View File

@@ -7,7 +7,7 @@ import Layouts from 'vite-plugin-vue-layouts'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Markdown from 'vite-plugin-md'
import { VitePWA } from 'vite-plugin-pwa'
// import { VitePWA } from 'vite-plugin-pwa'
import Inspect from 'vite-plugin-inspect'
import Prism from 'markdown-it-prism'
import LinkAttributes from 'markdown-it-link-attributes'
@@ -77,36 +77,36 @@ export default defineConfig({
},
}),
// https://github.com/antfu/vite-plugin-pwa
VitePWA({
// use default prompt
// registerType: 'autoUpdate',
registerType: 'prompt',
includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
manifest: {
name: '今天我们来做菜',
short_name: '来做菜',
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',
},
],
},
}),
// // https://github.com/antfu/vite-plugin-pwa
// VitePWA({
// // use default prompt
// // registerType: 'autoUpdate',
// registerType: 'prompt',
// includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
// manifest: {
// name: '今天我们来做菜',
// short_name: '来做菜',
// 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',
// },
// ],
// },
// }),
// https://github.com/antfu/vite-plugin-inspect
// Visit http://localhost:3333/__inspect/ to see the inspector