JSDoc的jQuery插件文档

duc*_*dhm 5 javascript jquery jsdoc jsdoc3

我想知道如何使用JSDoc记录jQuery插件?我的代码是:

   /**
     * The default configurations of comments
     * @typedef {Object} CommentConfig
     ...
     */

   /**
     * Show comments
     * @method comments
     * @version 1.0.1
     * @param {CommentConfig} options Configuration of comment
     */
    $.fn.comments = function (options) {
        // ..
    }
Run Code Online (Sandbox Code Playgroud)

我希望@method$.fn.comments,但它不工作.

Les*_*kov 5

根据JSDoc3文档,您应该@external在您的情况下使用:

/**
 * The jQuery plugin namespace.
 * @external "jQuery.fn"
 * @see {@link http://docs.jquery.com/Plugins/Authoring The jQuery Plugin Guide}
 */

/**
 * Show comments
 * @function external:"jQuery.fn".comments
 */
Run Code Online (Sandbox Code Playgroud)