7

YUIDocを使用してJavaScriptメソッドのドキュメントを作成しようとしています。次のようになります。

/** 
    Returns an instance of className

    @method getInstance
    @param {string} className the of the class used to create the instance
    @param {Object} options these are options used to create the instance
**/
function getInstance(className, options) { ..... }

options.idこれで、optionsオブジェクトは、、などのいくつかのパラメータを持つことができますoptions.single

この情報をこのドキュメントに追加するにはどうすればよい@paramですか?

4

2 に答える 2

5

参照から:http://yui.github.com/yuidoc/syntax/index.html

「例に示すように、@ paramタグをネストすることもできます。これにより、独自のネストされた構造を持つオブジェクトパラメータを文書化できます。」

@param {Object} [options] Data 
  to be mixed into the event 
  facade of the `change` 
  event(s) for these attributes.
  @param {Boolean} [options.silent]
    If `true`, no `change` event 
    will be fired.
于 2013-03-13T21:33:31.820 に答える
5

執筆時点での現在のバージョンであるYUIDOC0.3.45では、メソッドによって受信されたオブジェクトを記述するために、最初にオブジェクト(以下の例ではオプション)を宣言し、次にドット表記のプロパティ(たとえば、options.url)。

/**
 * Describe your method
 *
 * @method yourMethodName
 * @param {object} options - These are the options you may pass
 * @param {string} options.url - the url
 * @param {string} options.otherOption - description of other option
 */
于 2014-07-17T05:37:58.727 に答える