vuePress踩坑小記

搭建博客時,參照官網就能夠完成基本搭建
可是,也走了些彎路,先紀錄下來html

 想實現下拉框,展現不一樣路由

themeConfig配置以下:vue

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', '數組方法總結']
            ]
        }
   ]
}

效果以下:git

clipboard.png

clipboard.png

必須有默認README.md

每一個文件根路徑默認爲README.md,會被編譯成index.html文件es6

發佈到github博客

使用下面的npm 命令將項目編譯成htmlgithub

"docs:build": "vuepress build docs"

而後只將生成後的html項目文件,放到.github.io的倉庫裏vue-router

相關文章
相關標籤/搜索