gpt4 book ai didi

javascript - 如何在 JS Doc 中记录枚举值

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

我正在使用 JS Doc 生成 JS 文档。我有一个值很少的枚举。我想为每个属性生成文档。我尝试了以下方法:

/**
* Enum for display state.
* @readonly
* @enum {string}
*/
var DisplayState = {
/** @member {string} */
foreground: 'foreground',
/** @member {string} */
background: 'background',
/** @member {string} */
projected: 'projected'
};

但是生成 HTML 页面后,我只能看到枚举类型的文档,而不是单个属性。

我尝试了以下/** 一些评论 *//** @member {string} */和/** @property {string} */但似乎没有任何效果

最佳答案

我升级到 JS Doc 版本 3 ( https://github.com/jsdoc3/jsdoc ),此问题已修复。

参见下面的示例:

/**
* Enum for display state.
* @readonly
* @enum {string}
*/
var DisplayState = {
/** @member {string} */
/** The app is running in the foreground and can receive user input. */
foreground: 'foreground',

/** @member {string} */
/** The app is in the background and can't receive user input. */
background: 'background',

/** @member {string} */
/** The app is running in Phone Projection mode (Android Auto or Apple Car Play). */
projected: 'projected'
};

关于javascript - 如何在 JS Doc 中记录枚举值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39965167/

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