vue项目配置jsdoc

1、项目根目录添加jsdoc-vue.js

var compiler = require('vue-template-compiler');

exports.handlers = {
  // 利用 vue-template-compiler 编译 vue 模板
  beforeParse: function (e) {
    if (/\.vue$/.test(e.filename)) {
      var output = compiler.parseComponent(e.source);

      e.source = output.script ? output.script.content : '';
    }
  }
};
复制代码

2、根目录添加.jsdoc.conf.json,其他配置请参考jsdoc在线中文手册

{
    "tags": {
      "allowUnknownTags": true,
      // 指定所用词典
      "dictionaries": [
        "jsdoc"
      ]
    },
    // 查找文件的深度 需要用 -r 参数
    "recurseDepth": 10,
    "source": {
      "include": [
        // 需要编译的文件路径 使用时请替换
        "./src/packages"
      ],
      "includePattern": ".+\\.(vue)$",
      "excludePattern": "(^|\\/|\\\\)_"
    },
    // 使用插件
    "plugins": [
      // 插件路径
      "./jsdoc-vue"
    ],
    "templates": {
      "cleverLinks": false,
      "monospaceLinks": true,
      "useLongnameInNav": false,
      "showInheritedInNav": true
    },
    "opts": {
      // 文档输出路径
      "destination": "./static/doc",
      "encoding": "utf8",
      "private": true,
      "recurse": true,
      // 使用模板 minami
      "template": "./node_modules/minami"
    }
}
复制代码

3、在package.json 添加命令

"doc": "jsdoc -r -c .jsdoc.conf.json"
复制代码

4、依赖插件

jsdoc

vue-template-compiler

minami(生成文件模板)

转载于:https://juejin.im/post/5cf86e04f265da1b695d4dea

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值