(七) 組件說明文檔平台
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文檔目錄:
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/', // 可選的,標題的跳轉鏈接,應為絕對路徑且路徑正確
collapsable: false, // 可選的,默認為true
sidebarDepth: 1 // 可選的,默認1
},
{
text: 'Button按鈕',
link: '/button/',
collapsable: false,
sidebarDepth: 1
}
]
}
}
啟動項目:
npm run docs:dev
訪問文檔地址:
默認生成地址:http://localhost:3000/