From 6bb153d52f1fb0a508e61210d9bd6274787d6b91 Mon Sep 17 00:00:00 2001 From: onresize Date: Sun, 31 Mar 2024 23:24:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/client.js | 8 ++ docs/.vuepress/components/Fps.vue | 23 +++++ docs/.vuepress/components/utils/fps.js | 38 ++++++++ docs/.vuepress/config.js | 120 ++++++++----------------- docs/.vuepress/layouts/Layout.vue | 4 +- docs/.vuepress/public/favicon.ico | Bin 1903 -> 0 bytes docs/README.md | 4 +- package.json | 2 + yarn.lock | 39 ++++++++ 9 files changed, 151 insertions(+), 87 deletions(-) create mode 100644 docs/.vuepress/components/Fps.vue create mode 100644 docs/.vuepress/components/utils/fps.js delete mode 100644 docs/.vuepress/public/favicon.ico diff --git a/docs/.vuepress/client.js b/docs/.vuepress/client.js index 9bb7b5d..66f213c 100644 --- a/docs/.vuepress/client.js +++ b/docs/.vuepress/client.js @@ -1,9 +1,17 @@ import { defineClientConfig } from 'vuepress/client' import Layout from './layouts/Layout.vue' +import Fps from './components/Fps.vue' +// @see: https://v2.vuepress.vuejs.org/zh/advanced/cookbook/usage-of-client-config.html export default defineClientConfig({ + enhance({ app, router, siteData }) { + // app.component('Fps', Fps) + }, + setup() {}, layouts: { // 继承默认主题 、自定义 Layout, }, + // 直接被放置在客户端 Vue 应用的根节点下、作为全局组件 + rootComponents: [Fps], }) diff --git a/docs/.vuepress/components/Fps.vue b/docs/.vuepress/components/Fps.vue new file mode 100644 index 0000000..2fe3c3a --- /dev/null +++ b/docs/.vuepress/components/Fps.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/docs/.vuepress/components/utils/fps.js b/docs/.vuepress/components/utils/fps.js new file mode 100644 index 0000000..dfa64f2 --- /dev/null +++ b/docs/.vuepress/components/utils/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/.vuepress/config.js b/docs/.vuepress/config.js index 0b67b45..13d50c4 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -19,7 +19,34 @@ export default defineUserConfig({ lang: 'zh-CN', title: 'onresize', - description: '', + description: '💻学习📝记录🔗分享', + + head: [ + // 站点图标 + ['link', { rel: 'icon', href: '/web-blogs/image.png' }], + // SEO + [ + 'meta', + { + name: 'keywords', + content: 'onresize的笔记, 博客', + }, + ], + // 百度统计 + [ + 'script', + {}, + ` + var _hmt = _hmt || []; + (function() { + var hm = document.createElement("script"); + hm.src = "https://hm.baidu.com/hm.js?9eb20a946f6ada6ace9bb2de590f8ed3"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); + `, + ], + ], markdown: { code: { @@ -32,40 +59,21 @@ export default defineUserConfig({ theme: defaultTheme({ logo: '/image.png', - lastUpdated: true, + lastUpdatedText: '上次更新', + contributorsText: '贡献者', + notFound: [ + '这里什么都没有', + '我们怎么到这来了?', + '这是一个 404 页面', + '看起来我们进入了错误的链接', + ], + backToHome: '返回首页', // GitHub 仓库位置 repo: 'onresize/web-blogs', docsBranch: 'main', repoLabel: '📦️GitHub', - head: [ - // 站点图标 - ['link', { rel: 'icon', href: '/image.png' }], - // SEO - [ - 'meta', - { - name: 'keywords', - content: 'onresize的笔记, 博客', - }, - ], - // 百度统计 - [ - 'script', - {}, - ` - var _hmt = _hmt || []; - (function() { - var hm = document.createElement("script"); - hm.src = "https://hm.baidu.com/hm.js?9eb20a946f6ada6ace9bb2de590f8ed3"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(hm, s); - })(); - `, - ], - ], - docsDir: 'docs', navbar, @@ -79,59 +87,5 @@ export default defineUserConfig({ // 排除首页 isSearchable: (page) => page.path !== '/', }), - // RSS订阅源 - [ - 'feed', - { - canonical_base: 'https://onresize.github.io', - count: 5000, - }, - ], - // https://github.com/ekoeryanto/vuepress-plugin-sitemap - [ - 'sitemap', - { - hostname: domain, - }, - ], - // Google 分析 - [ - '@vuepress/google-analytics', - { - ga: 'G-P1NFFNHRH2', // 补充自己的谷歌分析 ID,比如 UA-00000000-0 - }, - ], - // https://github.com/lorisleiva/vuepress-plugin-seo - [ - 'seo', - { - siteTitle: (_, $site) => $site.title, - title: ($page) => $page.title, - description: ($page) => - $page.frontmatter.description || $page.description, - author: (_, $site) => $site.themeConfig.author || author, - tags: ($page) => $page.frontmatter.tags || tags, - type: ($page) => 'article', - url: (_, $site, path) => - ($site.themeConfig.domain || domain || '') + path, - image: ($page, $site) => - $page.frontmatter.image && - (($site.themeConfig.domain && - !$page.frontmatter.image.startsWith('http')) || - '') + $page.frontmatter.image, - publishedAt: ($page) => - $page.frontmatter.date && new Date($page.frontmatter.date), - modifiedAt: ($page) => $page.lastUpdated && new Date($page.lastUpdated), - }, - ], - // 点击特效 - [ - 'cursor-effects', - { - size: 2, // size of the particle, default: 2 - shape: 'star', // ['star' | 'circle'], // shape of the particle, default: 'star' - zIndex: 999999999, // z-index property of the canvas, default: 999999999 - }, - ], ], }) diff --git a/docs/.vuepress/layouts/Layout.vue b/docs/.vuepress/layouts/Layout.vue index d88f4ae..82f1063 100644 --- a/docs/.vuepress/layouts/Layout.vue +++ b/docs/.vuepress/layouts/Layout.vue @@ -5,9 +5,9 @@ import ParentLayout from '@vuepress/theme-default/layouts/Layout.vue' diff --git a/docs/.vuepress/public/favicon.ico b/docs/.vuepress/public/favicon.ico deleted file mode 100644 index aac7fc6a94a07b0687e900c093f8f09c57c161f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1903 zcmV-#2ax!QP)3aY6Cd4- zOcP%VO(@2w5u?Du5JN&)xNuWy6kQl)5{)|vqfN{tm?^NAA_^VkRkR2wrR~g6rmthZ znRBOi=DUw`?qfuM$preHbLQUj-S7Y1^BRRQ2LA_?WF`mzeE_hHcV`^`W?_GiS@-Tr z2PnPJ29WSjc!CrFY-eGAj9ArncasBn$NO|Tatr{v*>1Q@8WlQ^ zPkA3HC~%5}{cXgmw)N5hN@u(Y0J;Dm$W3Da5Mznx7^&L}SQnpkfP7JbVT=m48%o+L z$xH_TBuVX3mawp&Tob7x7MD;u<2wQ15&#_FPiG(h|7E2!-mP<$BPN|kLIAL{tn)$M z&I-c_@WcVU^9M*l0qo=^G5`l$}a%F`AG83#X}c5DUk32PmEKHj~b4 z*{5{IW6B4&Uj~48NvS>oH42nuM$~Cw76Gp20Hre?6m9PkrT-Sq%~NhRMzxP%+&%PZs`lh?2|@8Q69} z#dIIa0W5UwRqc)gDyIATX@Gzu-IwE91oU~Xd;cuJiX1UJgd{>~2k?o^Hd0`OZQb7? zW)~nsXDJ78-S?3KBUY@or+e(Y3rSB8K7B4C>;SI&nBeTI@YGw^6SF0aQ-$#Nj*>he z69MA0FVs6GJz3pj!fSB+zPCc&0n)l(YeV-7=L)Yp?~#*$E!{6)Ma-6XsQWTPd?hK5 zsRJsed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fXKaPR;C diff --git a/docs/README.md b/docs/README.md index 6cb3890..69d989d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,9 +3,9 @@ home: true # title: Home # heroText: BLOGS heroImage: /image.png -tagline: 笔记-博客✨ +tagline: 💻学习📝记录🔗分享 actions: - - text: 开始阅读 → + - text: ✨开始阅读 → link: /技术总结/踩坑总结/一个项目安装不同版本的依赖包 features: - title: 简洁至上⭐️ diff --git a/package.json b/package.json index a0d6d73..8df6339 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "@vuepress/theme-default": "2.0.0-rc.21", "vue": "^3.4.21", "vuepress": "2.0.0-rc.9", + "vuepress-plugin-cursor-effects": "^1.1.6", "vuepress-plugin-feed": "^0.1.9", + "vuepress-plugin-seo": "^0.2.0", "vuepress-plugin-sitemap": "^2.3.1" } } diff --git a/yarn.lock b/yarn.lock index f1da9fe..003a648 100644 --- a/yarn.lock +++ b/yarn.lock @@ -273,6 +273,27 @@ resolved "https://registry.npmmirror.com/@mdit-vue/types/-/types-2.0.0.tgz#466e13f63af80cb90ffdfbad82854cfa1c1e33e4" integrity sha512-1BeEB+DbtmDMUAfvbNUj5Hso8cSl2sBVK2iTyOMAqhfDVLdh+/9+D0JmQHaCeUk/vuJoMhOwbweZvh55wHxm4w== +"@moefy-canvas/core@^0.5.2": + version "0.5.2" + resolved "https://registry.npmmirror.com/@moefy-canvas/core/-/core-0.5.2.tgz#fd3994025942e911a6dc94b85e564818ef202f7b" + integrity sha512-XkaVE91Tiwb35zFmI1DbrJpMh0xe54QbzQrc7ATwMos4C08dxBnwExwXEVS7oEct7owVDY1UWxtRRVE7smtzHw== + +"@moefy-canvas/theme-popper@^0.5.2": + version "0.5.2" + resolved "https://registry.npmmirror.com/@moefy-canvas/theme-popper/-/theme-popper-0.5.2.tgz#717a29c6964362facf842affe47c0f016f0188d6" + integrity sha512-s6Gy27DKTLm2un5Od3fsAonnd7lN4pgyLXJ/omXisAZpVLbPg/Q5/QKpJLZvQ/08qNrn6X/GZjnWwvsHbJTBNw== + dependencies: + "@moefy-canvas/core" "^0.5.2" + "@moefy-canvas/utils" "^0.5.2" + ts-debounce "^4.0.0" + +"@moefy-canvas/utils@^0.5.2": + version "0.5.2" + resolved "https://registry.npmmirror.com/@moefy-canvas/utils/-/utils-0.5.2.tgz#11c9ac56e9a81456678ccd10b2234754e2a20cfe" + integrity sha512-DnI8I/cTBFfn3xoXwyyLEtye4pMI6zJFMxU1qps731xgYTWmzBqJPkZZd/2gfNnH5NnLUOGG7Ui3sMkmJ0vg0w== + dependencies: + "@moefy-canvas/core" "^0.5.2" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -3927,6 +3948,7 @@ stdin-discarder@^0.2.1: integrity sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ== "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: + name string-width-cjs version "4.2.3" resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4077,6 +4099,11 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" +ts-debounce@^4.0.0: + version "4.0.0" + resolved "https://registry.npmmirror.com/ts-debounce/-/ts-debounce-4.0.0.tgz#33440ef64fab53793c3d546a8ca6ae539ec15841" + integrity sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg== + tslib@^2.0.0, tslib@^2.0.3: version "2.6.2" resolved "https://registry.npmmirror.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -4203,6 +4230,13 @@ vue@^3.4.21: "@vue/server-renderer" "3.4.21" "@vue/shared" "3.4.21" +vuepress-plugin-cursor-effects@^1.1.6: + version "1.1.6" + resolved "https://registry.npmmirror.com/vuepress-plugin-cursor-effects/-/vuepress-plugin-cursor-effects-1.1.6.tgz#b71efc76e48a7f0f7492e60fc52047c3386569e9" + integrity sha512-4qXL2flMQcd6ecp+LhdChspobhdb9fkAfmRjRs2K3a/DiwtQtOE24jaVFCClwhfDpYuRe48a0KVeROYkdiWuXg== + dependencies: + "@moefy-canvas/theme-popper" "^0.5.2" + vuepress-plugin-feed@^0.1.9: version "0.1.9" resolved "https://registry.npmmirror.com/vuepress-plugin-feed/-/vuepress-plugin-feed-0.1.9.tgz#706fc381c1831c110d161b7e892057750c8904da" @@ -4216,6 +4250,11 @@ vuepress-plugin-feed@^0.1.9: remove-markdown "0.3.0" striptags "3.1.1" +vuepress-plugin-seo@^0.2.0: + version "0.2.0" + resolved "https://registry.npmmirror.com/vuepress-plugin-seo/-/vuepress-plugin-seo-0.2.0.tgz#2fa4fd7ef2eb6c71f62302f264aeba47c6560ee9" + integrity sha512-/Rqul20UTL30mZyCbNwkfAfP50Yr7jzWlavQ92OVzZ8PcpZGXoDc+eoKQyKLQKL3G96dqvuCCbIMbW7RRs7Bhw== + vuepress-plugin-sitemap@^2.3.1: version "2.3.1" resolved "https://registry.npmmirror.com/vuepress-plugin-sitemap/-/vuepress-plugin-sitemap-2.3.1.tgz#51298aca77a5de96396fdbd1103e1637dd61ae6a"