From 91a0fb6a63fc5bdeaaa68c23a2a50a1c26d7508f Mon Sep 17 00:00:00 2001 From: onresize Date: Fri, 29 Mar 2024 12:14:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 4 + docs/.vuepress/config.ts | 15 +- docs/.vuepress/sidebars/selfStudySideBar.ts | 2 + docs/.vuepress/theme/components/Navbar.vue | 2 +- docs/.vuepress/theme/components/Page.vue | 4 +- docs/.vuepress/theme/layouts/Layout.vue | 30 +- docs/.vuepress/theme/util/fps.js | 38 + docs/README.md | 1 + .../README.md" | 5 + .../MIME\347\261\273\345\236\213.md" | 4 + ...76\347\232\204\345\214\272\345\210\253.md" | 4 + ...50\345\210\260\350\277\233\351\230\266.md" | 206 + ...04\344\276\235\350\265\226\345\214\205.md" | 4 + ...md\347\233\256\345\275\225\346\240\221.md" | 58 + package-lock.json | 17 +- yarn.lock | 15997 ++++++++-------- 16 files changed, 8376 insertions(+), 8015 deletions(-) create mode 100644 docs/.vuepress/theme/util/fps.js create mode 100644 "docs/\346\212\200\346\234\257\346\200\273\347\273\223/\350\270\251\345\235\221\346\200\273\347\273\223/TS\345\205\245\351\227\250\345\210\260\350\277\233\351\230\266.md" create mode 100644 "docs/\346\212\200\346\234\257\346\200\273\347\273\223/\350\270\251\345\235\221\346\200\273\347\273\223/\351\241\271\347\233\256\347\224\237\346\210\220md\347\233\256\345\275\225\346\240\221.md" diff --git a/.npmrc b/.npmrc index 12ab889..c7732b0 100644 --- a/.npmrc +++ b/.npmrc @@ -10,4 +10,8 @@ package-lock=true # pnpm i 生成pnpm-lock.yaml文件、yarn 生成yarn.lock文件 lockfile=true +# 对等依赖安装 +auto-install-peers=true +strict-peer-dependencies=false + diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 81ef965..db4235d 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -5,7 +5,7 @@ import footer from './footer' import extraSideBar from './extraSideBar' const author = 'onresize' -const domain = 'https://gitee.com' +const domain = 'https://onresize.github.io/web-blogs/' const tags = ['程序员', '编程', '前端'] export default defineConfig({ @@ -31,10 +31,10 @@ export default defineConfig({ var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); - hm.src = "https://hm.baidu.com/hm.js?907fc6c6099a87f6c010a6b5cd433d61"; + hm.src = "https://hm.baidu.com/hm.js?9eb20a946f6ada6ace9bb2de590f8ed3"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); - })(); + })(); `, ], ], @@ -52,9 +52,9 @@ export default defineConfig({ ['@vuepress/back-to-top'], // Google 分析 [ - "@vuepress/google-analytics", + '@vuepress/google-analytics', { - ga: "G-P1NFFNHRH2", // 补充自己的谷歌分析 ID,比如 UA-00000000-0 + ga: 'G-P1NFFNHRH2', // 补充自己的谷歌分析 ID,比如 UA-00000000-0 }, ], ['@vuepress/medium-zoom'], @@ -117,12 +117,13 @@ export default defineConfig({ logo: '/image.png', nav: navbar, sidebar, - lastUpdated: '最近更新', - + lastUpdated: '上一次更新', // GitHub 仓库位置 repo: 'onresize/web-blogs', docsBranch: 'main', + smoothScroll: true + // 编辑链接 // editLinks: true, // editLinkText: "完善页面", diff --git a/docs/.vuepress/sidebars/selfStudySideBar.ts b/docs/.vuepress/sidebars/selfStudySideBar.ts index d17d945..63b9925 100644 --- a/docs/.vuepress/sidebars/selfStudySideBar.ts +++ b/docs/.vuepress/sidebars/selfStudySideBar.ts @@ -6,6 +6,8 @@ export default [ "踩坑总结/一个项目不同版本的依赖包.md", "踩坑总结/MIME类型.md", "踩坑总结/React.Fragment和空标签的区别.md", + "踩坑总结/TS入门到进阶.md", + "踩坑总结/项目生成md目录树.md", ], }, ]; diff --git a/docs/.vuepress/theme/components/Navbar.vue b/docs/.vuepress/theme/components/Navbar.vue index 7799c7a..16726c8 100644 --- a/docs/.vuepress/theme/components/Navbar.vue +++ b/docs/.vuepress/theme/components/Navbar.vue @@ -30,7 +30,7 @@ v-if="isAlgoliaSearch" :options="algolia" /> - + diff --git a/docs/.vuepress/theme/components/Page.vue b/docs/.vuepress/theme/components/Page.vue index 80de0ca..6070673 100644 --- a/docs/.vuepress/theme/components/Page.vue +++ b/docs/.vuepress/theme/components/Page.vue @@ -33,11 +33,13 @@ import PageEdit from '@theme/components/PageEdit.vue' import PageNav from '@theme/components/PageNav.vue' import PageSidebarToc from '@theme/components/PageSidebarToc.vue' +import { devDependencies } from '../../../../package.json' export default { components: { PageEdit, PageNav, PageSidebarToc }, props: ['sidebarItems', 'pageSidebarItems'], mounted() { - console.log(this.$site, this, 'this.$site') + // console.log(this.$site, this, 'this.$site') + console.log(`%cvuepress:%c${devDependencies.vuepress}`, 'padding: 3px; color: white; background: #023047; border-radius: 5px 0 0 5px;', 'padding: 3px; color: white; background: #219EBC;border-radius: 0 5px 5px 0;') } } diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index 635f7b3..03dd049 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -26,10 +26,12 @@ - + + +
@@ -41,6 +43,7 @@ import Sidebar from '@theme/components/Sidebar.vue' import PageSidebar from '@theme/components/ExtraSidebar.vue' import Footer from "@theme/components/Footer.vue"; import { resolveSidebarItems, resolveHeaders } from '../util' +import { loopFps } from '../util/fps' export default { @@ -117,6 +120,7 @@ export default { mounted() { // console.log(config,this.pageSidebarItems, 'config') + loopFps() this.$router.afterEach(() => { this.isSidebarOpen = false }) @@ -150,3 +154,25 @@ export default { } } + + diff --git a/docs/.vuepress/theme/util/fps.js b/docs/.vuepress/theme/util/fps.js new file mode 100644 index 0000000..dfa64f2 --- /dev/null +++ b/docs/.vuepress/theme/util/fps.js @@ -0,0 +1,38 @@ +export const loopFps = () => { + if ( + null == window.localStorage.getItem('fpson') || + '1' == window.localStorage.getItem('fpson') + ) { + var rAF = + window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + function (e) { + window.setTimeout(e, 1e3 / 60) + }, + frame = 0, + allFrameCount = 0, + lastTime = Date.now(), + lastFameTime = Date.now(), + loop = function () { + var e = Date.now(), + a = e - lastFameTime, + o = Math.round(1e3 / a) + if ( + ((lastFameTime = e), allFrameCount++, frame++, e > 1e3 + lastTime) + ) { + if ((o = Math.round((1e3 * frame) / (e - lastTime))) <= 5) + var n = '卡成ppt🤢' + else if (o <= 15) n = '电竞级帧率😖' + else if (o <= 25) n = '有点难受😨' + else if (o < 35) n = '不太流畅🙄' + else if (o <= 45) n = '还不错哦😁' + else n = '十分流畅🤣' + ;(document.getElementById('fps').innerHTML = `FPS: ${o}🚀`), + (frame = 0), + (lastTime = e) + } + rAF(loop) + } + loop() + } else document.getElementById('fps').style = 'display:none!important' +} diff --git a/docs/README.md b/docs/README.md index 2351b72..40859f5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,6 @@ --- permalink: / +lang: zh-CN --- ```js diff --git "a/docs/\346\212\200\346\234\257\346\200\273\347\273\223/README.md" "b/docs/\346\212\200\346\234\257\346\200\273\347\273\223/README.md" index 0c89338..e11ced6 100644 --- "a/docs/\346\212\200\346\234\257\346\200\273\347\273\223/README.md" +++ "b/docs/\346\212\200\346\234\257\346\200\273\347\273\223/README.md" @@ -1,3 +1,8 @@ + +