gpt4 book ai didi

class - JsDoc 链接到类的属性

转载 作者:行者123 更新时间:2023-12-05 03:14:04 25 4
gpt4 key购买 nike

我正在尝试使用在 Windows 上的 NodeJS 下托管的 JsDoc 3.3.0 来记录我的项目使用的模型。几乎一切正常,除了我似乎无法@link 到类的属性。我的评论如下:

/**
* Encapsulates all data concerning the speed, acceleration and braking characteristics
* of a train or enemy.
* @class speedModel
* @property {Float} value The current real speed.
* @property {Integer} target The speed we are attempting to reach. Always greater than or equal to zero and less than or equal to {@link speedModel#max}.
* @property {Integer} max The maximum value possible of {@link speedModel#target}.
* @property {Float} acceleration The rate per tick at which {@link speedModel#value} approaches {@link speedModel#target} if it is greater.
* @property {Float} deceleration The rate per tick at which {@link speedModel#value} approaches {@link speedModel#target} if it is lesser.
*/

奇怪的是,我可以毫无问题地@link 到 speedModel,如果我添加静态成员,我可以使用 speedModel.nameOfMember 链接到它们。我正在关注此处的文档:http://usejsdoc.org/tags-link.html .

我做错了什么?

最佳答案

创建对象内部属性的文档,如下所示:

/**
* Encapsulates all data concerning the speed, acceleration and braking characteristics
* of a train or enemy.
* @class
* @property {Float} value The current real speed.
* @property {Integer} target The speed we are attempting to reach. Always greater than or equal to zero and less than or equal to {@link speedModel#max}.
* @property {Integer} max The maximum value possible of {@link speedModel#target}.
* @property {Float} acceleration The rate per tick at which {@link speedModel#value} approaches {@link speedModel#target} if it is greater.
* @property {Float} deceleration The rate per tick at which {@link speedModel#value} approaches {@link speedModel#target} if it is lesser.
*/
function SpeedModel() {
/** @property {Float} - The current real speed. */
this.value = '';
};

/**
* Converts kilometers per hour to miles per hour (see: {@link SpeedModel#value})
* @param {Float} speed The speed in miles per hour
* @return {Float} The speed in kilometers per hour
*/
function kmhToMph(speed) {
};

关于class - JsDoc 链接到类的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27471004/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com