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 的示例,@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;