【xingorg1-ui】基於vue3.0從0-1搭建組件庫 (七) 組件文檔平台雛形


(七) 組件說明文檔平台

vitepress

缺點:

沒有vuepress的主題多、也沒有他的功能多,基本的功能等需要自己手動配置。 新玩意兒,貴在體驗

好處:

輕量 第一次打包比較慢,后期打包都很快

插件官網文檔:

https://github.com/vuejs/vitepress

vitepress的安裝:

npm install vitepress -D

package.json腳本配置

"docs:dev""vitepress dev docs",
"docs:build""vitepress build docs",

創建相應docs文檔目錄:

image.png

docs>index.md為入口文件

設置配置文件:

/*
 * @Author: @Guojufeng
 * @Date: 2020-11-01 19:47:03
 * @LastEditors: @Guojufeng
 * @LastEditTime: 2020-11-01 19:54:02
 * @FilePath: /Users/guojufeng/Documents/GitHub/xingorg1-ui/docs/.vitepress/config.js
 */

module.exports = {
  title'xingorg1-ui'// 設置網站標題
  description'vue3組件庫',
  dest'./build'// 輸出目錄
  themeConfig: {
    nav: [
      { test'主頁'link'/' },
      { test'聯系我'link'/' },
      { test'源碼'link'/' },
    ],
    sidebar: [
      {
        text'Icon圖標'// 必要的
        link'/icon/'// 可選的,標題的跳轉鏈接,應為絕對路徑且路徑正確
        collapsablefalse// 可選的,默認為true
        sidebarDepth1 // 可選的,默認1
      },
      {
        text'Button按鈕',
        link'/button/',
        collapsablefalse,
        sidebarDepth1
      }
    ]
  }
}

啟動項目:

npm run docs:dev image.png

訪問文檔地址:

默認生成地址:http://localhost:3000/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM