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'
-