mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
feat(theme): add support layout for blog profile (#182)
This commit is contained in:
parent
5f0dd0dfa2
commit
db28c8bd8c
@ -247,6 +247,7 @@ interface BlogOptions {
|
|||||||
- `profile.circle`: 是否为圆形头像
|
- `profile.circle`: 是否为圆形头像
|
||||||
- `profile.location`: 用户地理位置
|
- `profile.location`: 用户地理位置
|
||||||
- `profile.organization`: 用户所在组织/公司
|
- `profile.organization`: 用户所在组织/公司
|
||||||
|
- `profile.layout`: 个人信息展示在左侧还是右侧,`'left' | 'right'`
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
|
|
||||||
@ -260,6 +261,7 @@ export default {
|
|||||||
circle: true,
|
circle: true,
|
||||||
location: '杭州,中国',
|
location: '杭州,中国',
|
||||||
organization: 'xxx公司',
|
organization: 'xxx公司',
|
||||||
|
layout: 'right',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,11 +52,19 @@ import VPBlogProfile from 'vuepress-theme-plume/components/Blog/VPBlogProfile.vu
|
|||||||
export default defineUserConfig({
|
export default defineUserConfig({
|
||||||
theme: plumeTheme({
|
theme: plumeTheme({
|
||||||
profile: {
|
profile: {
|
||||||
name: '你的名字',
|
name: '您的名字',
|
||||||
description: '描述文字',
|
description: '描述文字,座右铭/签名',
|
||||||
avatar: '/blogger.png',
|
avatar: '/blogger.png',
|
||||||
|
location: '您的位置',
|
||||||
|
organization: '您的组织',
|
||||||
circle: true, // 是否为圆形头像
|
circle: true, // 是否为圆形头像
|
||||||
}
|
layout: 'right', // 个人信息在左侧还是右侧,'left' | 'right'
|
||||||
|
},
|
||||||
|
// 社交链接
|
||||||
|
social: [
|
||||||
|
{ icon: 'github', link: 'https://github.com/vuepress-theme-plume' },
|
||||||
|
// ... more
|
||||||
|
]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
@ -22,7 +22,10 @@ const { theme, page } = useData()
|
|||||||
<div class="vp-blog" :class="{ 'home-blog': homeBlog }" vp-blog>
|
<div class="vp-blog" :class="{ 'home-blog': homeBlog }" vp-blog>
|
||||||
<slot name="blog-top" />
|
<slot name="blog-top" />
|
||||||
|
|
||||||
<div class="blog-container" :class="{ 'no-profile': !theme.profile }">
|
<div
|
||||||
|
class="blog-container"
|
||||||
|
:class="{ 'no-profile': !theme.profile, 'left': theme.profile?.layout === 'left' }"
|
||||||
|
>
|
||||||
<VPBlogNav v-if="!theme.profile" is-local />
|
<VPBlogNav v-if="!theme.profile" is-local />
|
||||||
|
|
||||||
<VPTransitionFadeSlideY>
|
<VPTransitionFadeSlideY>
|
||||||
@ -117,6 +120,10 @@ const { theme, page } = useData()
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blog-container:not(.no-profile).left {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
.blog-container.no-profile {
|
.blog-container.no-profile {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 784px;
|
max-width: 784px;
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const svg = computed(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a
|
<a
|
||||||
class="vp-social-link"
|
class="vp-social-link no-icon"
|
||||||
:href="link"
|
:href="link"
|
||||||
:aria-label="ariaLabel ?? (typeof icon === 'string' ? icon : '')"
|
:aria-label="ariaLabel ?? (typeof icon === 'string' ? icon : '')"
|
||||||
target="_blank" rel="noopener" v-html="svg"
|
target="_blank" rel="noopener" v-html="svg"
|
||||||
|
|||||||
@ -326,6 +326,12 @@ export interface PlumeThemeProfile {
|
|||||||
* 组织,公司
|
* 组织,公司
|
||||||
*/
|
*/
|
||||||
organization?: string
|
organization?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 布局位置,左侧或者右侧
|
||||||
|
* @default 'right'
|
||||||
|
*/
|
||||||
|
layout?: 'left' | 'right'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ========================== Page Meta ====================== */
|
/** ========================== Page Meta ====================== */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user