# Yapi-plugin-export-docx-data **Repository Path**: chenguangfu/Yapi-plugin-export-docx-data ## Basic Information - **Project Name**: Yapi-plugin-export-docx-data - **Description**: No description available - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-05-02 - **Last Updated**: 2022-03-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # YAPI导出word文件插件 在平台”数据导出“下拉菜单增加”docx“选项,导出word文件 # 方案 使用[docxtemplater](https://docxtemplater.readthedocs.io/en/latest/#),提供模板文件渲染数据,生成word文件 # 数据格式 ```javasrcript { curProjectName: '', // 与“数据导出”-“json”,导出的json文件数据结构保持一致 apis: [ { "index": 0, "name": "公共分类", "desc": "公共分类", "add_time": 1551153428, "up_time": 1551153428, "list": [ { "query_path": { "path": "/api/test", "params": [] }, "edit_uid": 0, "status": "undone", "type": "static", "req_body_is_json_schema": true, "res_body_is_json_schema": false, "api_opened": false, "index": 0, "tag": [], "_id": 11, "method": "GET", "catid": 11, "title": "test", "path": "/api/test", "project_id": 11, "req_params": [], "res_body_type": "json", "uid": 11, "add_time": 1551159382, "up_time": 1551249632, "req_query": [ { "required": "1", "_id": "5c7630e0aeb004607a9d5776", "name": "a", "desc": "啊啊" }, { "required": "1", "_id": "5c7630e0aeb004607a9d5775", "name": "b", "example": "", "desc": "闭包" } ], "req_headers": [], "req_body_form": [], "__v": 0, "desc": "", "markdown": "", "res_body": "" } ] } ], // 与“动态”页面,“/api/log/list”接口返回数据结构保持一致 log: [ { add_time: 1551922145 content: "" data: {interface_id: 790, cat_id: 168,…} type: "project" typeid: 63 uid: 13 username: "admin" __v: 0 _id: 4261 } ], } ``` # TIPS * 需要在vendors目录下新建input.docx模板文件,可参考本例中模板文件 * parser.js文件提供自定义tag及tag格式化功能,其中$index、$$index表示数组及嵌套数据索引值