Skip to content

添加额外页面模块写在哪里? #702

Answered by Mister-Hope
Linya-IronMan asked this question in Q&A
Discussion options

You must be logged in to vote
  1. 自己建一个插件写在插件 api里。
// .vuepress/config.js

export default defineUserConfig({
  plugins: [
    {
      // 在这里使用 onIntialized
    }
  ]
});
  • 你可以在 clientAppEnhanceFiles 里拿到 router 对象以指定组件注册路由(当然这会失去 SSR)。(它更简单)
  • 或者自行扩展主题注册一个新的布局,并在插件 API 里 createPage 并在 Front Matter 指定 layout(有SSR)。

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Linya-IronMan
Comment options

@Mister-Hope
Comment options

Answer selected by Mister-Hope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants