import{parse}from'vue-docgen-api'asyncfunctionparseMyComponent(filePath:string){varcomponentInfoSimple=awaitparse(filePath)varcomponentInfoConfigured=awaitparse(filePath,{alias:{'@assets':path.resolve(__dirname,'src/assets')},modules:[path.resolve(__dirname,'src')],addScriptHandlers:[function(document...
Created from react styleguidist for Vue Components with a living style guide - vue-docgen-api to parse type TSInstantiationExpression (#1533) · vue-styleguidist/vue-styleguidist@3d22684
在 Vue 项目中,我们可以使用 vue-docgen-api 这个库。首先,确保你已经在项目中安装了 Node.js 和 npm。 npm install vue-docgen-api --save-dev 1. 2. 编写 Vue 组件 为了生成文档,我们需要在组件中添加规范的注释。以下是一个名为 MyComponent.vue 的示例组件,包含一些注释说明。 <template> {{ title...
npm install vue-docgen-api --save-dev APIThe tool can be used programmatically to extract component information and customize the extraction process:var vueDocs = require('vue-docgen-api'); var componentInfo = vueDocs.parse(filePath);parse(filePath)...
先介绍vue-docgen-api 吧,想要查看vue-docgen-api的主要功能,我们需要借助node进行实现, const { parse } = require('vue-docgen-api') //引入资源包 asyncfunctiongetData(){varresult = await parse('./vue/vue.vue')//异步加载需要解析的vue的文件 ...
vue-docgen-api/dist/main.d.ts Version: 2.01 kBTypeScriptView Raw 1 import Documentation, { ComponentDoc, PropDescriptor, SlotDescriptor, EventDescriptor, MethodDescriptor, ExposeDescriptor, BlockTag, Param, Tag, ParamTag, ParamType } from './Documentation'; 2 import type { ParseOptions, Doc...
先介绍vue-docgen-api 吧,想要查看vue-docgen-api的主要功能,我们需要借助node进行实现, const { parse } = require('vue-docgen-api') //引入资源包 async function getData(){ var result = await parse('./vue/vue.vue')//异步加载需要解析的vue的文件 ...
import{SlotDescriptor}from'vue-docgen-api'import{cleanReturn}from'./utils'exportdefault(slots:{[slotName:string]:SlotDescriptor},opt?:{isSubComponent:booleanhasSubComponents:boolean}):string=>{constslotNames=Object.keys(slots)if(!slotNames.length){return''// if no slots avoid creating the section...
## Install Install the module directly from npm: ```sh npm install vue-docgen-api --save-dev ``` ## API The tool can be used programmatically to extract component information and customize the extraction process: ```js var vueDocs = require('vue-docgen-api')...
它通过vue-docgen-api,能够将注释转换成属性描述展现在页面上。因此我们只需要写注释,就能够生成组件属性相关的文档。而我们的另一个需求,在展示demo时能够同时展示源码,它也能够做到。我们可以通过两种方式: 在Vue组件中使用<docs></docs>标签来写demo,这样做对组件有侵入,感觉不太好 ...