From 56f1eac7c86e4c6fd315c92b474f0814c9356eb7 Mon Sep 17 00:00:00 2001 From: PeterAlbus Date: Sat, 26 Mar 2022 10:26:43 +0800 Subject: [PATCH] make some part of page as component --- components.d.ts | 2 + src/App.vue | 2 +- src/components/FriendLinks.vue | 37 ++++++++++ src/components/PersonalInfo.vue | 43 +++++++++++ src/router/index.ts | 30 ++++---- src/views/About.vue | 34 ++------- src/views/Blog.vue | 28 ++------ src/views/Home.vue | 55 +++----------- src/views/Photo.vue | 124 +++++++++++++------------------- src/views/Types.vue | 33 ++------- src/views/UploadPhoto.vue | 8 +-- 11 files changed, 177 insertions(+), 219 deletions(-) create mode 100644 src/components/FriendLinks.vue create mode 100644 src/components/PersonalInfo.vue diff --git a/components.d.ts b/components.d.ts index 1e49101..29113c4 100644 --- a/components.d.ts +++ b/components.d.ts @@ -22,6 +22,8 @@ declare module 'vue' { ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElUpload: typeof import('element-plus/es')['ElUpload'] Footer: typeof import('./src/components/Footer.vue')['default'] + FriendLinks: typeof import('./src/components/FriendLinks.vue')['default'] + PersonalInfo: typeof import('./src/components/PersonalInfo.vue')['default'] TopNavBar: typeof import('./src/components/TopNavBar.vue')['default'] } } diff --git a/src/App.vue b/src/App.vue index 4cf924d..916c68b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -145,7 +145,7 @@ a { *::-webkit-scrollbar { /*滚动条整体样式*/ - width : 10px; /*高宽分别对应横竖滚动条的尺寸*/ + width : 3px; /*高宽分别对应横竖滚动条的尺寸*/ height: 1px; } *::-webkit-scrollbar-thumb { diff --git a/src/components/FriendLinks.vue b/src/components/FriendLinks.vue new file mode 100644 index 0000000..746ae3b --- /dev/null +++ b/src/components/FriendLinks.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/components/PersonalInfo.vue b/src/components/PersonalInfo.vue new file mode 100644 index 0000000..ca93b9d --- /dev/null +++ b/src/components/PersonalInfo.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 419421c..c17dad6 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -17,7 +17,7 @@ const routes: Array = [ meta:{ title:'主页——PeterAlbus的博客', content:{ - keywords:'PeterAlbus,Vue', + keywords:'PeterAlbus,Vue,个人博客', description:'PeterAlbus的博客主页' } } @@ -113,7 +113,7 @@ const routes: Array = [ meta:{ title:'添加友情链接——PeterAlbus的博客', content:{ - keywords:'PeterAlbus,Vue', + keywords:'PeterAlbus,Vue,个人博客', description:'PeterAlbus的博客' } } @@ -125,18 +125,18 @@ const router = createRouter({ routes }) -// router.beforeEach((to, from, next)=>{ -// if(to.meta.content) { -// // @ts-ignore -// document.querySelector('meta[name="keywords"]').setAttribute('content',to.meta.content.keywords) -// // @ts-ignore -// document.querySelector('meta[name="description"]').setAttribute('content',to.meta.content.description) -// } -// if(to.meta.title) { -// // @ts-ignore -// document.title = to.meta.title -// } -// next() -// }) +router.beforeEach((to, from, next)=>{ + if(to.meta.content) { + // @ts-ignore + document.querySelector('meta[name="keywords"]').setAttribute('content',to.meta.content.keywords) + // @ts-ignore + document.querySelector('meta[name="description"]').setAttribute('content',to.meta.content.description) + } + if(to.meta.title) { + // @ts-ignore + document.title = to.meta.title + } + next() +}) export default router diff --git a/src/views/About.vue b/src/views/About.vue index 810e2e0..db942b3 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -20,34 +20,8 @@ -
-
- -

PeterAlbus

- - - - - - - - - - - - - - - -
-
- -
-

友情链接

- -
+ +
@@ -55,8 +29,10 @@