@vuepress/plugin-active-header-links (opens new window)

页面滚动时自动激活侧边栏链接的插件

安装

yarn add -D @vuepress/plugin-active-header-links
# OR npm install -D @vuepress/plugin-active-header-links

使用

module.exports = {
  plugins: ['@vuepress/active-header-links']
}

配置选项

module.exports = {
  plugins: ['@vuepress/active-header-links', {
    sidebarLinkSelector: '.sidebar-link',
    headerAnchorSelector: '.header-anchor'
  }]
}

选项

sidebarLinkSelector

  • 类型: string
  • 默认值: .sidebar-link

headerAnchorSelector

  • 类型: string
  • 默认值: .header-anchor