vue 项目自动生成组件说明文档 styleguidist

styleguidist 是什么?

在我们的项目中,只要你想你就可以根据配置生成自己想要的组件文档,支持网页端展示。

使用方式

(1) 安装

复制代码
vue add styleguidist

生成配置文件及安装 vue-cli-plugin-styleguidist (vuecli 的对应插件)

复制代码
npm install --save-dev vue-styleguidist

安装项目插件

(2)配置文件

配置package.json脚本

复制代码
 "styleguide": "NODE_ENV=development styleguidist server",
  "styleguide:build": "NODE_ENV=production styleguidist build",

styleguide.config.js

复制代码
module.exports = {
	// set your styleguidist configuration here
	title: '公共组件文档',
	// components: 'src/components/**/[A-Z]*.vue',
	components: ['src/components/AppButton.vue'],
	defaultExample: true,
	exampleMode: 'expand'
}

默认会识别 src/components 下的组件文件.

(3)根据文档要求增加注释

具体编写规则参照官方文档:https://vue-styleguidist.github.io/docs/Documenting.html

(4)生成组件说明文档

复制代码
npm run styleguide
相关推荐
掘了15 小时前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
崔庆才丨静觅15 小时前
实用免费的 Short URL 短链接 API 对接说明
前端
崔庆才丨静觅15 小时前
5分钟快速搭建 AI 平台并用它赚钱!
前端
崔庆才丨静觅16 小时前
比官方便宜一半以上!Midjourney API 申请及使用
前端
Moment16 小时前
富文本编辑器在 AI 时代为什么这么受欢迎
前端·javascript·后端
崔庆才丨静觅16 小时前
刷屏全网的“nano-banana”API接入指南!0.1元/张量产高清创意图,开发者必藏
前端
剪刀石头布啊16 小时前
jwt介绍
前端
爱敲代码的小鱼16 小时前
AJAX(异步交互的技术来实现从服务端中获取数据):
前端·javascript·ajax
吹牛不交税16 小时前
admin.net-v2 框架使用笔记-netcore8.0/10.0版
vue.js·.netcore
Cobyte17 小时前
AI全栈实战:使用 Python+LangChain+Vue3 构建一个 LLM 聊天应用
前端·后端·aigc