我正在尝试将customTag添加到jsdoc.我在plugins目录中创建了一个文件,如下所示:
method.js
exports.defineTags = function(dictionary) {
dictionary.defineTag("methodHttp", {
mustHaveValue: true,
canHaveType: false,
canHaveName: true,
onTagged: function(doclet, tag) {
doclet.methodHttp = tag.value;
}
});
};
Run Code Online (Sandbox Code Playgroud)
然后我加入了我的conf.json:
{
"tags": {
"allowUnknownTags": true
},
"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": [ "plugins/method" ],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": {
"outputSourceFiles": true
}
},
"jsVersion": 180
}
Run Code Online (Sandbox Code Playgroud)
现在我尝试在我的模板上得到这个.我在method.tmpl上.
我试过了:
self.find('methodHttp')[0]
data.methodHttp[0]
data.methodHttp
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我的代码出了什么问题?