JSDoc 中文网

Synonyms

语法

¥Syntax

@member [<type>] [<name>]

概述

¥Overview

@member 标记标识任何没有更专门类型的成员,例如 "class"、"function" 或 "constant"。成员可以选择具有类型和名称。

¥The @member tag identifies any member that does not have a more specialized kind, such as "class", "function", or "constant". A member can optionally have a type as well as a name.

示例

¥Examples

将 @member 与 Data#point 一起使用
/** @class */
function Data() {
    /** @member {Object} */
    this.point = {};
}

下面是使用 @var(@member 的同义词)来记录(虚拟)变量 'foo' 的示例。

¥Here is an example of using @var, a synonym of @member, to document a (virtual) variable 'foo'.

使用 @var 记录虚拟成员
/**

 * A variable in the global namespace called 'foo'.

 * @var {number} foo
 */

上面的例子相当于下面的例子:

¥The above example is equivalent to the following:

/**

 * A variable in the global namespace called 'foo'.

 * @type {number}
 */
var foo;