vuepress-plugin-auto-sidebar 插件相关

3/16/2021 vuepressblog

# 自动侧边栏插件 vuepress-plugin-auto-sidebar

快速了解 | vuepress 自动生成侧边栏 (opens new window)

# 某个分组/文件夹/路由 不想显式侧边栏

某个分组/文件夹/路由 不想显式侧边栏,如何设置 · Issue #19 · shanyuhai123/vuepress-plugin-auto-sidebar (opens new window)

# readme.md 排序永远在前

方法,添加自定义的排序函数

const sortFn = key => (a, b) => {

    let a1 = a[key].toLowerCase();
    let a2 = b[key].toLowerCase();

    if (a1 === "readme") {
        return -1;
    }
    if (a2 === "readme") {
        return 1;
    }
    if (a1 === a2) {
        return 0;
    }
    return a1 > a2 ? 1 : -1;
}

module.exports = {
    "vuepress-plugin-auto-sidebar": {
        sort: sortFn,
    },
}
更新时间: Tuesday, March 16, 2021 21:56