欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue中使用js-doc的案例代碼

 更新時(shí)間:2024年01月12日 15:54:43   作者:大可-  
這篇文章主要介紹了vue中使用js-doc的相關(guān)知識(shí),本文結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧

安裝依賴

安裝vue-template-compiler

npm install ?vue-template-compiler

安裝minami

npm install minami

安裝js-doc

npm install js-doc

根目錄下創(chuàng)建 .jsdoc.conf.json

內(nèi)容:

{
    "tags": {
      "allowUnknownTags": true,
      // 指定所用詞典
      "dictionaries": [
        "jsdoc"
      ]
    },
    // 查找文件的深度 需要用 -r 參數(shù)
    "recurseDepth": 10,
    "source": {
      "include": [
        // 需要編譯的文件路徑 使用時(shí)請(qǐng)?zhí)鎿Q
        "./src/index/packages"
      ],
      "includePattern": ".+\\.(vue)$",
      "excludePattern": "(^|\\/|\\\\)_"
    },
    // 使用插件
    "plugins": [
      // 插件路徑
      "./jsdoc-vue"
    ],
    "templates": {
      "cleverLinks": false,
      "monospaceLinks": true,
      "useLongnameInNav": false,
      "showInheritedInNav": true
    },
    "opts": {
      // 文檔輸出路徑
      "destination": "./src/index/doc",
      "encoding": "utf8",
      "private": true,
      "recurse": true,
      // 使用模板 minami
      "template": "./node_modules/minami"
    }
}

根目錄創(chuàng)建 jsdoc-vue.js

內(nèi)容:

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 : "";
    }
  }
};

package.json

內(nèi)容:

 "doc": "jsdoc -r -c .jsdoc.conf.json"

使用npm run doc 運(yùn)行

到此這篇關(guān)于vue中使用js-doc的文章就介紹到這了,更多相關(guān)vue使用js-doc內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論