搭建博客時,參照官網就可以完成基本搭建
但是,也走了些彎路,先紀錄下來
想實現下拉框,展示不同路由
themeConfig配置如下:
nav: [
{
text: 'home',
link: '/'
},
{
text: 'JS',
items: [
{
text: 'ES6',
link: '/js/ES6/'
},
{
text: 'Vue',
link: '/js/vue/'
}
]
}
]
sidebar: {
'/js/vue/': [
'', // README.md
{
title: 'vue-router',
children: [
['vueRouter/vueRouter.md', '基礎'],
['vueRouter/navigation.md', '導航守衛']
]
}
],
'/js/ES6/': [
{
title: 'ES6',
children: [
['es6/array.md', '數組方法總結']
]
}
]
}
效果如下:
必須有默認README.md
每個文件根路徑默認爲README.md,會被編譯成index.html文件
發佈到github博客
使用下面的npm 命令將項目編譯成html
"docs:build": "vuepress build docs"
然後只將生成後的html項目文件,放到.github.io的倉庫裏