# component-help-demo **Repository Path**: devsapp/component-help-demo ## Basic Information - **Project Name**: component-help-demo - **Description**: 组件帮助提示demo - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-08 - **Last Updated**: 2021-08-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 组件说明 + 实现代码文档化,通过注释完成文档生成 + 实现资源上报实例 ,参考 index.report ## 注释文档部分 ### 规范定义 要求组件中的实体 文件命名为 entity.ts 或者 interface.ts 如果多个文件可以定义为 xx_entity.ts 或者 xx_interface.ts 实体定义后请 "export" 导出供全局查询, 注释规范可以参考 entity.ts 的 CreateFunctionInputsProps ### 注释示意 ``` /** * s cli fc-api createFunction\nAPI Document: https://help.aliyun.com/document_detail/189984.html // 简单的备注 * @pre_help // 主体帮助 的前置帮助注释 * {"header":"Logs","content":"Query the function log. You need to open SLS log service."} * @pre_help * {"header": "Detail", "content": "Query the function log. You need to open SLS log service."} * @after_help // 主体帮助 的后置帮助注释 ,这里使用 ref 可以再次获取GlobalParams 的注释内容 * {"ref":"GlobalParams"} * @example // 示例 * {"header": "Example1","content": [{"desc":"Query the function log. You need to open SLS log service.","example":"$ s exec -- logs -t"},{"desc":"Query the function log. You need to open SLS log service.","example":"$ s exec -- logs -t"}]} * @example * {"header": "Example2","content": [{"desc":"Query the function log. You need to open SLS log service.","example":"$ s exec -- logs -t"}]} */ ``` ### 使用方法 提供基类 BaseComponent (当前common/base文件)在写核心组件核心类的时候继承即可。 需要用到帮助的时候只需要调用 super.help(<实体名如CreateFunctionInputsProps>) ## 上报资源数据部分 资源发生改变是调用下面的实例,另外整个资源的定义参考 report.d.ts ``` super.__report({ name: 'fc', content: { region: 'cn-hangzhou', service: 'aa', function:'bb' } }) ```