2013-02-25 55 views
2

我从here中复制了一个示例。下面是示例代码,但问题是Store.TAX_RATE在文档中显示为Item的属性,而不是作为模块Store的属性。任何建议为什么?YUIDoc/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; 
}; 

回答

2

这是因为根据YUIDoc术语模块仅仅是一个相关类的集合,因此它不能包含任何东西,但类。

你可以做的,而不是对文档存储和Store.Item既是类:

/** 
* 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) { 
};