xinlei3166 / vitepress-theme-demoblock

一个基于 Vitepress 的主题插件,它可以帮助你在编写文档的时候增加 Vue 示例。
https://xinlei3166.github.io/vitepress-demo/
MIT License
200 stars 50 forks source link

能否提供自定义的demo组件 #60

Closed shiouhoo closed 7 months ago

xinlei3166 commented 7 months ago

在 .vitepress/theme/index.js 中可以覆盖的。 默认是

import Demo from 'vitepress-theme-demoblock/dist/client/components/Demo.vue'
import DemoBlock from 'vitepress-theme-demoblock/dist/client/components/DemoBlock.vue'

export function useComponents(app) {
  app.component('Demo', Demo)
  app.component('DemoBlock', DemoBlock)
}

你可以自己编写 Demo 组件,然后注册 app.component('Demo', CustomDemo).