2013-02-05 26 views
1

在YUIDoc中,我想評論作爲參數傳遞的對象文字。請參見下面的代碼片段:如何評論YUIDoc中的對象文字

@param {Array} colDefs Array of object literal column definitions for the grid<ul> 
    <li>title - Column header display</li> 
    <li>key - The key of the column from the JSON data array</li> 
    <li>type - The data type of the column. </li></ul> 

我加什麼標籤,列出項目,所以我可以指定屬性的類型(字符串,對象等)?如果我添加{String},它只會顯示爲文本,而不是我使用@param標記獲得的漂亮格式。

也許這是不可能的?

+0

找到一個解決辦法,但它有點乏味的使用:

  • 標題的字符串
    列標題顯示
  • 回答

    5

    您可以通過首先指定配置對象,然後指定所有屬性爲object.property參數來記錄配置對象。它看起來像這樣:

    /** 
    @param {Object} config   Object literal containing configuration parameters 
    @param {Boolean} config.useFoo Whether to use Foo or not 
    @param {String} [config.option] An optional string parameter 
    */ 
    
    +0

    謝謝,解決我的問題!我應該仔細閱讀文檔,這只是一個例子,但沒有足夠清楚地解釋。 –