fix: sidebar问题

This commit is contained in:
pengzhanbo 2022-04-12 14:35:22 +08:00
parent dfc7217efa
commit c9defafe39
5 changed files with 69 additions and 3 deletions

View File

@ -44,6 +44,28 @@ export default defineUserConfig<PlumeThemeOptions>({
},
],
},
{
link: '/interview-question',
text: '面试题解析',
dir: '面试题',
sidebar: [
{
text: 'HTML',
dir: 'HTML',
children: [],
},
{
text: 'CSS',
dir: 'CSS',
children: ['盒模型'],
},
{
text: 'JavaScript',
dir: 'JavaScript',
children: [],
},
],
},
],
},
darkMode: true,
@ -55,6 +77,10 @@ export default defineUserConfig<PlumeThemeOptions>({
text: 'typescript',
link: '/note/typescript/',
},
{
text: '面试题',
link: '/note/interview-question',
},
],
},
],

View File

@ -0,0 +1,13 @@
---
title: 盒模型
createTime: 2022/04/12 11:27:38
author: pengzhanbo
permalink: /note/interview-question/sfnusib9/
---
`CSS盒模型` 问题是 面试中比较常见的基础题型。提问的方式,可能包括以下:
- 请简述 CSS 盒模型
- 什么是 标准模式和 怪异模式

View File

@ -0,0 +1,22 @@
---
title: 面试题
createTime: 2022/04/12 10:16:26
author: pengzhanbo
permalink: /note/interview-question/
---
### 说明
本笔记主要用于整理、记录,从个人角度尝试回答 可能会遇到的、跟其他人讨论过的 面试题目。
但本笔记 所收集的面试题, 主要是在 前端的范畴中,不涉及其他。
如果你准备找工作,想刷刷面试题,可以 以此作为参考,
但请不要作为标准答案,因为这些仅仅是我个人的理解,
并不一定百分百正确。
::: tip
如果这篇笔记对你有帮助,你有遇到不错的面试题,希望可以在本笔记的评论区提交你遇到的面试题与我分享,我不胜感激!
如果你发现本笔记中有哪些错误,欢迎指出,我将虚心受教!
:::

View File

@ -36,6 +36,10 @@ defineProps({
&:hover {
color: var(--c-text-accent);
}
&.router-link-active {
color: var(--c-text-accent);
}
}
p {
font-weight: 600;
@ -45,6 +49,7 @@ defineProps({
.sidebar-items {
font-size: 16px;
padding-left: 1.25rem;
font-weight: 300;
}
}
}

View File

@ -114,18 +114,17 @@ function sidebarByConfig(
children: [],
} as SidebarItem
} else {
dir = path.join(dir, sidebar.dir || '')
link = path.join(link || '', sidebar.link || '')
const current = sidebar.link
? findNotePage(sidebar.link, dir, notePageList)
: undefined
return {
text: sidebar.text || sidebar.dir || '',
link: current?.link || link,
link: current?.link,
children: sidebarByConfig(
sidebar.text,
sidebar.link,
dir,
path.join(dir, sidebar.dir || ''),
sidebar.children,
notePageList
),
@ -150,6 +149,7 @@ function findNotePage(
} else {
return notePageList.find((page) => {
const relative = page.relativePath.join('/')
console.log(relative, dir, sidebar)
return (
relative === path.join(dir, sidebar) ||
relative === path.join(dir, sidebar + '.md') ||