Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

vuepress能否局部自定义导航功能?

目的:想在vuepress的项目导航里添加一个下拉框,点击后能执行一段js逻辑,并不是单纯的跳转链接,下方是vuepress提供的导航配置
image.png
image.png

我期望的效果是

// .vuepress/config.js
module.exports = {
  themeConfig: {
    nav: [
      {
        text: 'Languages',
        ariaLabel: 'Language Menu',
        items: [
          { text: 'Chinese', onclick: () => {}, active: () => true },
          { text: 'Japanese', onclick: () => {}, active: () => false }
        ]
      }
    ]
  }
}

如果事件加不了,link能使用正则也行


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
{link: 'javascript:xxx()'}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...