vue中使用js-doc的案例代碼
更新時間:2024年01月12日 15:54:43 作者:大可-
這篇文章主要介紹了vue中使用js-doc的相關知識,本文結合實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧
安裝依賴
安裝vue-template-compiler
npm install ?vue-template-compiler
安裝minami
npm install minami
安裝js-doc
npm install js-doc
根目錄下創(chuàng)建 .jsdoc.conf.json

內容:
{
"tags": {
"allowUnknownTags": true,
// 指定所用詞典
"dictionaries": [
"jsdoc"
]
},
// 查找文件的深度 需要用 -r 參數(shù)
"recurseDepth": 10,
"source": {
"include": [
// 需要編譯的文件路徑 使用時請?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

內容:
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

內容:
"doc": "jsdoc -r -c .jsdoc.conf.json"
使用npm run doc 運行

到此這篇關于vue中使用js-doc的文章就介紹到這了,更多相關vue使用js-doc內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
element-ui?table表格控件實現(xiàn)單選功能代碼實例
這篇文章主要給大家介紹了關于element-ui?table表格控件實現(xiàn)單選功能的相關資料,單選框是指在?Element?UI?的表格組件中,可以通過單選框來選擇一行數(shù)據(jù)。用戶只能選擇一行數(shù)據(jù),而不能同時選擇多行,需要的朋友可以參考下2023-09-09
從0搭建Vue3組件庫如何使用?glup?打包組件庫并實現(xiàn)按需加載
這篇文章主要介紹了從0搭建Vue3組件庫如何使用?glup?打包組件庫并實現(xiàn)按需加載,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-03-03

