首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >YUIDoc/javascript -如何记录模块属性

YUIDoc/javascript -如何记录模块属性
EN

Stack Overflow用户
提问于 2013-02-25 17:15:10
回答 1查看 1K关注 0票数 2

我从here复制了一个例子。下面是示例代码,但问题是Store.TAX_RATE在文档中显示为Item的属性,而不是module Store的属性。有什么建议吗?

示例代码:

代码语言:javascript
复制
/**
  * This module contains classes for running a store.
  * @module Store
  */
var Store = Store || {};

/**
  * `TAX_RATE` is stored as a percentage. Value is 13.
  * @property TAX_RATE
  * @static
  * @final
  * @type Number
  */
Store.TAX_RATE = 13;


/**
 * @class Item
 * @constructor
 * @param name {String} Item name
 * @param price {Number} Item price
 * @param quantity {Number} Item quantity (the number available to buy)
 */
Store.Item = function (name, price, quantity) {
  /**
    * @property name
    * @type String
    */
  this.name = name;
  /**
    * @property price
    * @type String
    */
  this.price = price * 100;
  /**
    * @property quantity
    * @type Number
    */
  this.quantity = quantity;
  /**
    * @property id
    * @type Number
  */
  this.id = Store.Item._id++;
  Store.Item.list[this.id] = this;
 };
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-04 03:13:36

这是因为根据YUIDoc术语,模块只是相关类的集合,因此它只能包含类。

相反,您可以将Store和Store.Item都作为类进行文档记录:

代码语言:javascript
复制
/**
 * This module contains classes for running a store.
 * @class Store
 */
var Store = Store || {};

/**
 * `TAX_RATE` is stored as a percentage. Value is 13.
 * @property TAX_RATE
 * @type Number
 */
Store.TAX_RATE = 13;

/**
 * @class Store.Item
 */
Store.Item = function (name, price, quantity) {
};
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15063561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档